From f398b34414e3dbde31c0ec4b627aaa7ccf593ee0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 16 Jan 2015 14:04:02 +0100 Subject: adding logic to free buffers allocated for POST processing when connection dies without completion --- src/mint/taler-mint-httpd_parsing.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src/mint/taler-mint-httpd_parsing.c') diff --git a/src/mint/taler-mint-httpd_parsing.c b/src/mint/taler-mint-httpd_parsing.c index a976c0c0..9a3fc1d6 100644 --- a/src/mint/taler-mint-httpd_parsing.c +++ b/src/mint/taler-mint-httpd_parsing.c @@ -156,11 +156,11 @@ buffer_append (struct Buffer *buf, * GNUNET_SYSERR on internal error */ int -process_post_json (struct MHD_Connection *connection, - void **con_cls, - const char *upload_data, - size_t *upload_data_size, - json_t **json) +TALER_MINT_parse_post_json (struct MHD_Connection *connection, + void **con_cls, + const char *upload_data, + size_t *upload_data_size, + json_t **json) { struct Buffer *r = *con_cls; @@ -228,6 +228,23 @@ process_post_json (struct MHD_Connection *connection, } +/** + * Function called whenever we are done with a request + * to clean up our state. + * + * @param con_cls value as it was left by + * #TALER_MINT_parse_post_json(), to be cleaned up + */ +void +TALER_MINT_parse_post_cleanup_callback (void *con_cls) +{ + struct Buffer *r = con_cls; + + if (NULL != r) + buffer_deinit (r); +} + + /** * Navigate through a JSON tree. * @@ -451,3 +468,5 @@ TALER_MINT_mhd_request_arg_data (struct MHD_Connection *connection, ? GNUNET_SYSERR : GNUNET_NO; return GNUNET_OK; } + +/* end of taler-mint-httpd_parsing.c */ -- cgit v1.2.3