qom: Fix memory leak in object_property_set_link()
PATCH 1/1 qom: Fix memory leak in object_property_set_link()
Save the result of the call to object_get_cannonical_path() so we can free it.
Signed-off-by Vlad Yasevich <[email protected]>
--- qom/object.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
qom/object.c +3 -2
@@ -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_cannonical_path (value); +object_property_set_str (obj, path, name, errp); +gfree (path); } Object *object_property_get_link(Object *obj, const char *name,
Signature · 1 line
1.8.4.2
Quoted 15 lines · Vlad Yasevich
Save the result of the call to
object_get_cannonical_path()so we can free it.Signed-off-by Vlad Yasevich <[email protected]>--- qom/object.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)qom/object.c +0
-0@@ -838,8 +838,9 @@ char *object_property_get_str(Object *obj, const char *name, void object_property_set_link(Object *obj, Object *value,
qom/object.c char *object_property_get_str(Object *obj, const char *name, · line 846
Quoted 10 lines
qom/object.c +3
-2const char *name, Error **errp) { -object_property_set_str (obj ,object_get_canonical_path (value ), -name ,errp ); + gchar *path = object_get_cannonical_path(value); +object_property_set_str (obj, path, name, errp); +gfree (path); } Object *object_property_get_link(Object *obj, const char *name,
Self-nack. Forgot to commit the changes that actually make it build and work :/
-vlad