From fa753c3aa18e2432b94801b55a5ffa0072187efc Mon Sep 17 00:00:00 2001 From: Stefan de Konink Date: Sun, 14 Dec 2008 03:27:52 +0100 Subject: [PATCH] A potential memory leak was fixed, we cannot just bail out without cleaning up the mess we have made using axl and the post part of the request. --- handler_osm_put.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/handler_osm_put.c b/handler_osm_put.c index bab3f82..c372092 100644 --- a/handler_osm_put.c +++ b/handler_osm_put.c @@ -257,13 +257,15 @@ cherokee_handler_osm_init_put (cherokee_handler_osm_t *hdl) lat = strtod(axl_node_get_attribute_value(node, "lat"), NULL); if (errno == ERANGE) { conn->error_code = http_bad_request; - return ret_error; + ret = ret_error; + goto xml_error; } lon = strtod(axl_node_get_attribute_value(node, "lon"), NULL); if (errno == ERANGE) { conn->error_code = http_bad_request; - return ret_error; + ret = ret_error; + goto xml_error; } else { cherokee_buffer_t sql1 = CHEROKEE_BUF_INIT; cherokee_buffer_add_str (&sql1, SQL_TRANSACTION_START); @@ -322,13 +324,15 @@ cherokee_handler_osm_init_put (cherokee_handler_osm_t *hdl) lat = strtod(axl_node_get_attribute_value(node, "lat"), NULL); if (errno == ERANGE) { conn->error_code = http_bad_request; - return ret_error; + ret = ret_error; + goto xml_error; } lon = strtod(axl_node_get_attribute_value(node, "lon"), NULL); if (errno == ERANGE) { conn->error_code = http_bad_request; - return ret_error; + ret = ret_error; + goto xml_error; } else { /* TODO: more error checking */ long testid = 0; @@ -411,6 +415,8 @@ cherokee_handler_osm_init_put (cherokee_handler_osm_t *hdl) } } } + +xml_error: axl_doc_free (doc); } -- 2.11.4.GIT