summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interchange.c1
-rw-r--r--interchange/typedefs.h1
-rw-r--r--request.c2
3 files changed, 4 insertions, 0 deletions
diff --git a/interchange.c b/interchange.c
index 88d4d10..8a70bbb 100644
--- a/interchange.c
+++ b/interchange.c
@@ -110,6 +110,7 @@ void interchange_free_response(interchange_response *response)
#ifdef __EMSCRIPTEN__
emscripten_fetch_close(response);
#else
+ free(response->url);
free(response->data);
curl_easy_cleanup(response->curl);
free(response);
diff --git a/interchange/typedefs.h b/interchange/typedefs.h
index 02a412f..a799671 100644
--- a/interchange/typedefs.h
+++ b/interchange/typedefs.h
@@ -9,6 +9,7 @@ typedef emscripten_fetch_t interchange_response;
#include <curl/curl.h>
typedef struct {
void *userData;
+ char *url;
char *data;
size_t numBytes;
CURL *curl;
diff --git a/request.c b/request.c
index e8dfcf7..32e46f0 100644
--- a/request.c
+++ b/request.c
@@ -160,6 +160,8 @@ void request(void (*handler)(interchange_response *), void (*callback)(void *),
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, append);
interchange_response *response = malloc(sizeof(interchange_response));
+ response->url = malloc(length + 1);
+ strcpy(response->url, url);
response->data = malloc(1);
response->numBytes = 0;
response->userData = callback;