Skip to contentSkip to conversation

qom: Fix memory leak in object_property_set_link()

PATCH Superseded Vlad Yasevich 1 participant 2 messages Nov 15, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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.

---
 qom/object.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
qom/object.c +3 -2
index b617f26..21b6f87 100644
@@ -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
#1 lore raw
Quoted 15 lines · Vlad Yasevich

Save the result of the call to object_get_cannonical_path() so we can free it.

---
  qom/object.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
qom/object.c +0 -0
index b617f26..21b6f87 100644
@@ -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 -2
                                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,

Self-nack. Forgot to commit the changes that actually make it build and work :/

-vlad