libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 46c0d3f4704b138ca279881c8cb222feb77989c6
parent 0497e9c801754079920412b4d92733eae7984daf
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Wed, 25 Aug 2021 20:33:51 +0300

querystring_example: free memory with new error check

Diffstat:
Msrc/examples/querystring_example.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/examples/querystring_example.c b/src/examples/querystring_example.c @@ -70,7 +70,10 @@ ahc_echo (void *cls, if (me == NULL) return MHD_NO; /* Error allocating memory */ if (resp_len != snprintf (me, resp_len + 1, fmt, "q", val)) + { + free (me); return MHD_NO; /* Error forming the response body */ + } response = MHD_create_response_from_buffer (resp_len, me, MHD_RESPMEM_MUST_FREE); if (response == NULL)