diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index b7b7ad3a62..d9b5280b2d 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -831,8 +831,10 @@ int ofnode_write_prop(ofnode node, const char *propname, int len, return -ENOMEM; new->name = strdup(propname); - if (!new->name) + if (!new->name) { + free(new); return -ENOMEM; + } new->value = (void *)value; new->length = len;