From 786472f41bc2a7db3bd271fccaaff57fc74b6989 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Sun, 24 Nov 2024 19:48:43 +0300 Subject: Add LibHTTPC_free --- src/libhttpc.c | 7 ++++--- src/malloc.c | 5 +++-- src/request.c | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/libhttpc.c b/src/libhttpc.c index 2f700b2..5a39210 100644 --- a/src/libhttpc.c +++ b/src/libhttpc.c @@ -1,8 +1,9 @@ #include "libhttpc.h" -void LibHTTPC(LibHTTPC_Malloc *malloc, LibHTTPC_Realloc *realloc) +void LibHTTPC(LibHTTPC_Malloc *malloc, LibHTTPC_Realloc *realloc, LibHTTPC_Free *free) { - LibHTTPC_malloc = malloc; - LibHTTPC_realloc = realloc; + LibHTTPC_malloc = malloc; + LibHTTPC_realloc = realloc; + LibHTTPC_free = free; } diff --git a/src/malloc.c b/src/malloc.c index a654e31..6287e4a 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -1,5 +1,6 @@ #include "libhttpc.h" -LibHTTPC_Malloc *LibHTTPC_malloc = NULL; -LibHTTPC_Realloc *LibHTTPC_realloc = NULL; +LibHTTPC_Malloc *LibHTTPC_malloc = NULL; +LibHTTPC_Realloc *LibHTTPC_realloc = NULL; +LibHTTPC_Free *LibHTTPC_free = NULL; diff --git a/src/request.c b/src/request.c index 3e017b7..56bf47b 100644 --- a/src/request.c +++ b/src/request.c @@ -74,7 +74,7 @@ struct LibHTTPC_Request *LibHTTPC_loadRequest(struct LibHTTPC_Request *request_b void LibHTTPC_Request_(struct LibHTTPC_Request *request) { if (request->header_selfalloc) - free(request->headers); + LibHTTPC_free(request->headers); if (request->selfalloc) - free(request); + LibHTTPC_free(request); } -- cgit 1.4.1