diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index b7b7ad3a625da9cbff62bed3644067eabc72ac1f..d9b5280b2d4f163fea8b7cd34e17e7d47db36586 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;