diff options
-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; } |