Skip to content

Commit

Permalink
qom: Fix memory leak in object_property_set_link()
Browse files Browse the repository at this point in the history
Save the result of the call to object_get_canonical_path()
so we can free it.

Cc: [email protected]
Signed-off-by: Vlad Yasevich <[email protected]>
Reviewed-by: Amos Kong <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
  • Loading branch information
Vlad Yasevich authored and afaerber committed Nov 19, 2013
1 parent 5c5432e commit 2d3aa28
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions qom/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,8 +838,9 @@ char *object_property_get_str(Object *obj, const char *name,
void object_property_set_link(Object *obj, Object *value,
const char *name, Error **errp)
{
object_property_set_str(obj, object_get_canonical_path(value),
name, errp);
gchar *path = object_get_canonical_path(value);
object_property_set_str(obj, path, name, errp);
g_free(path);
}

Object *object_property_get_link(Object *obj, const char *name,
Expand Down

0 comments on commit 2d3aa28

Please sign in to comment.