summaryrefslogtreecommitdiff
path: root/imap/src/c-client/http.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2022-06-10 19:42:36 -0600
committerEduardo Chappa <chappa@washington.edu>2022-06-10 19:42:36 -0600
commit21813be5a29ac9a2c6e9075383c528b4b52d6c5f (patch)
tree2977a4482ce56e8c9458686f6885d86ffda8fe22 /imap/src/c-client/http.c
parent1f26808faba44fe9140d19cf93d7b8560513e5ec (diff)
downloadalpine-21813be5a29ac9a2c6e9075383c528b4b52d6c5f.tar.xz
* Cleaning up some memory leaks reported by Valgrind. Memory leaks in the
handling of http headers will be handled through a different update.
Diffstat (limited to 'imap/src/c-client/http.c')
-rw-r--r--imap/src/c-client/http.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/imap/src/c-client/http.c b/imap/src/c-client/http.c
index f1602621..bb0f34d4 100644
--- a/imap/src/c-client/http.c
+++ b/imap/src/c-client/http.c
@@ -87,6 +87,7 @@ typedef struct http_header_data_s {
/* helper functions */
HTTP_STATUS_S *http_status_line_get(unsigned char *);
void http_status_line_free(HTTP_STATUS_S **);
+void http_header_free(HTTP_HEADER_DATA_S **);
void buffer_add(unsigned char **, unsigned char *);
unsigned char *hex_escape_url_part(unsigned char *, unsigned char *);
unsigned char *encode_url_body_part(unsigned char *, unsigned char *);
@@ -990,11 +991,21 @@ http_get(HTTPSTREAM *stream, HTTP_PARAM_S **h)
}
void
+http_header_free(HTTP_HEADER_DATA_S **hdata)
+{
+ if(hdata == NULL || *hdata == NULL) return;
+
+ fs_give((void **) hdata);
+}
+
+void
http_close (HTTPSTREAM *stream)
{
if(stream){
if (stream->netstream) net_close (stream->netstream);
stream->netstream = NIL;
+ if(stream->status) http_status_line_free(&stream->status);
+ if(stream->header) http_header_free(&stream->header);
if (stream->url) fs_give ((void **) &stream->url);
if (stream->urlhost) fs_give ((void **) &stream->urlhost);
if (stream->urltail) fs_give ((void **) &stream->urltail);