summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorawy <awy@awy.one>2025-08-24 00:05:10 +0300
committerawy <awy@awy.one>2025-08-24 00:05:10 +0300
commit96b0596c8c9caa28040439e8e5389494406f331f (patch)
tree24ef6f3f9fee64a06fc3e21ccc320aa2b22fcb5b /src
parent5a0107ba1e9388a3d4ade7faa06a1c94786ae3d2 (diff)
json tree cleanup
Diffstat (limited to 'src')
-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;
}