summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sttorrent.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sttorrent.c b/src/sttorrent.c
index 7a5a73c..a911071 100644
--- a/src/sttorrent.c
+++ b/src/sttorrent.c
@@ -140,7 +140,10 @@ main(void)
torrents = cJSON_GetObjectItem(torrents, "arguments");
torrents = cJSON_GetObjectItem(torrents, "torrents");
- if (cJSON_GetArraySize(torrents) == 0) { return 0; }
+ if (cJSON_GetArraySize(torrents) == 0) {
+ cJSON_Delete(torrents);
+ return 0;
+ }
/* Counting statuses */
for (int i = 0; i < cJSON_GetArraySize(torrents); i++) {
@@ -165,5 +168,6 @@ main(void)
printf("%d", status_count[i]);
}
+ cJSON_Delete(torrents);
return 0;
}