commit 4a08535168c35630675b1cd2b855a8b3d63867b0
parent 6dc147dce2690c0f6de72f36b8c453bfdd6053bb
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 11 Oct 2026 14:59:49 +0200
use free(), not GNUNET_free() on jansson allocated data
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/curl/curl.c b/src/curl/curl.c
@@ -227,6 +227,9 @@ TALER_curl_easy_post (struct TALER_CURL_PostContext *ctx,
char *str;
size_t slen;
+ /* In case this context is re-used (i.e. on a retry), we must
+ not leak the body of the previous request. */
+ GNUNET_free (ctx->json_enc);
str = json_dumps (body,
JSON_COMPACT);
if (NULL == str)
@@ -267,7 +270,11 @@ TALER_curl_easy_post (struct TALER_CURL_PostContext *ctx,
}
else
{
- ctx->json_enc = str;
+ /* @a str was allocated by jansson, but ctx->json_enc is
+ freed using GNUNET_free(); so we must copy. */
+ ctx->json_enc = GNUNET_strndup (str,
+ slen);
+ free (str);
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Uploading JSON of %d bytes (%s)\n",