summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dynotify.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/dynotify.c b/dynotify.c
index 8061398..c77aeed 100644
--- a/dynotify.c
+++ b/dynotify.c
@@ -108,7 +108,9 @@ int main (void)
curl_easy_perform(curl);
//printf("%s\n",chunk.response);
- if (json_object_get_int(json_object_object_get(json_object_object_get(json_tokener_parse(chunk.response),"room"),"show_status")) == 1)
+ json_object *root;
+ root=json_tokener_parse(chunk.response);
+ if (json_object_get_int(json_object_object_get(json_object_object_get(root,"room"),"show_status")) == 1)
{
if(!room[i].up)
{
@@ -127,6 +129,8 @@ int main (void)
room[i].up=false;
free(chunk.response);
+ // must call json_object_put to free *root, else memory leak!
+ json_object_put(root);
}
sleep(60);
}