summaryrefslogtreecommitdiffstats
path: root/binding
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-30 17:09:29 +0000
commit866fc80a1010eb14a30ead1685a2066e04a0c473 (patch)
treed4beda1528d11d12b0c7ffb2b16d208841bf7ed1 /binding
parentdc37667bdd91b6b267473d97870ed6d85204a4cf (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>
Diffstat (limited to 'binding')
-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 44944df..f2f3302 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);