提交 205dd5af 编写于 作者: M Mario Six 提交者: Simon Glass

core: ofnode: Fix mem leak in error path

A newly created property is currently not freed if a name could not be
allocated. This patch fixes the resulting memory leak in the error
patch.

Reported-by: Coverity (CID: 184085)
Fixes: e369e58d ("core: Add functions to set properties in live-tree")
Signed-off-by: NMario Six <mario.six@gdsys.cc>
上级 ab88bd2b
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册