diff options
Diffstat (limited to 'dynotify.c')
-rw-r--r-- | dynotify.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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); } |