summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2017-08-24 13:18:52 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2017-08-24 13:33:05 -0700
commit4a245cfd11c387c297bff9b000142a26683b1d1d (patch)
treefc41581fa0295e3a937302b60ddd11a4fff0ba29
parentbf1b11ab772ad3e8afe16fd061531fbaa36c4d82 (diff)
binding: media: fix memory leak with json objects
In case of empty media insertion the allocated json_object's weren't used. Run json_object_put to force the freeing of the objects. Bug-AGL: SPEC-842 Change-Id: I48fe8cf0824030119140fa581223c282855981d7 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--binding/mediaplayer-api.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/binding/mediaplayer-api.c b/binding/mediaplayer-api.c
index e81c98a..813ab97 100644
--- a/binding/mediaplayer-api.c
+++ b/binding/mediaplayer-api.c
@@ -86,8 +86,11 @@ static json_object *new_json_object_from_device(GList *list)
json_object_array_add(jarray, jstring);
}
- if (jstring == NULL)
+ if (jstring == NULL) {
+ json_object_put(jarray);
+ json_object_put(jresp);
return NULL;
+ }
json_object_object_add(jresp, "Media", jarray);