diff options
author | qorg11 <qorg@vxempire.xyz> | 2021-06-29 15:09:44 +0200 |
---|---|---|
committer | qorg11 <qorg@vxempire.xyz> | 2021-06-29 15:09:44 +0200 |
commit | b7c4b2bd5ef3118348e6fc49b223754ff39b65c8 (patch) | |
tree | 1c720b0ee599fb31615fcf6d24593ce8e6c777f4 | |
parent | 63da7e2786e1fc9cbec870b138041e13525af98e (diff) | |
download | demiurge-b7c4b2bd5ef3118348e6fc49b223754ff39b65c8.tar.gz demiurge-b7c4b2bd5ef3118348e6fc49b223754ff39b65c8.zip |
Fixed a few memory leaks
-rw-r--r-- | src/post.c | 6 | ||||
-rw-r--r-- | src/upload_file.c | 3 |
2 files changed, 9 insertions, 0 deletions
@@ -93,6 +93,9 @@ post_status(const char *status, const char *scope, const char *media_id) curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime); curl_easy_perform(curl); + curl_easy_cleanup(curl); + curl_slist_free_all(header_list); + curl_mime_free(mime); /* The the url */ @@ -106,5 +109,8 @@ post_status(const char *status, const char *scope, const char *media_id) free(url); free(authorization_header); free(chunk.response); + free(parsed_json); + free(json_url); + return 0; } diff --git a/src/upload_file.c b/src/upload_file.c index 2e2d8c9..5f937fb 100644 --- a/src/upload_file.c +++ b/src/upload_file.c @@ -84,10 +84,13 @@ upload_file(const char *path, const char *description, char **id_ptr) free(url_to_post); curl_easy_cleanup(curl); curl_mime_free(mime); + curl_slist_free_all(header_list); /* Get the media id */ parsed_json = json_tokener_parse(buf); json_object_object_get_ex(parsed_json, "id", &json_media_id); const char *media_id = json_object_get_string(json_media_id); *id_ptr = media_id; + free(parsed_json); + return 0; } |