commit ef7127b4b5362e0f458edad2986f4bdac7c100a6
parent 67b955192462a0777d370647b199e79d8f17f82a
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date: Thu, 8 Mar 2018 18:19:38 +0100
dup'ing path string.
Diffstat:
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/twister/taler-twister-service.c b/src/twister/taler-twister-service.c
@@ -829,6 +829,7 @@ delete_object (struct MHD_Connection *con,
char *token;
char *last_token;
char *mod_body;
+ char *path_dup;
unsigned int index;
if (NULL == (parsed_response = json_loadb
@@ -840,9 +841,10 @@ delete_object (struct MHD_Connection *con,
hr->response);
}
- last_token = strrchr (delete_path, '.') + 1;
+ path_dup = GNUNET_strdup (delete_path);
+ last_token = strrchr (path_dup, '.') + 1;
/* Give first nondelim char. */
- token = strtok (delete_path, ".");
+ token = strtok (path_dup, ".");
element = parsed_response;
do
{
@@ -850,8 +852,13 @@ delete_object (struct MHD_Connection *con,
* another option is to return an empty body. */
if (NULL == token)
{
- TALER_LOG_WARNING ("Whole body won't be deleted\n");
+ TALER_LOG_WARNING ("Whole body won't be deleted"
+ ", token: %s/%p, last_token: %s/%p\n",
+ token, token,
+ last_token, last_token);
+
json_decref (parsed_response);
+ GNUNET_free (path_dup);
return MHD_queue_response (con,
hr->response_code,
hr->response);
@@ -873,6 +880,7 @@ delete_object (struct MHD_Connection *con,
}
TALER_LOG_WARNING ("Path token '%s' not found\n",
token);
+ GNUNET_free (path_dup);
return MHD_queue_response (con,
hr->response_code,
hr->response);
@@ -895,6 +903,7 @@ delete_object (struct MHD_Connection *con,
{
TALER_LOG_WARNING ("Could not delete '%s'\n", last_token);
json_decref (parsed_response);
+ GNUNET_free (path_dup);
return MHD_queue_response (con,
hr->response_code,
hr->response);
@@ -906,7 +915,6 @@ delete_object (struct MHD_Connection *con,
MHD_RESPMEM_MUST_COPY);
json_decref (parsed_response);
delete_path[0] = '\0';
-
struct HttpResponseHeader *header;
for (header = hr->header_head;
NULL != header;
@@ -915,6 +923,7 @@ delete_object (struct MHD_Connection *con,
(MHD_YES == MHD_add_response_header (hr->mod_response,
header->type,
header->value));
+ GNUNET_free (path_dup);
return MHD_queue_response (con,
hr->response_code,
hr->mod_response);
@@ -1191,7 +1200,12 @@ create_response (void *cls,
}
if ('\0' != delete_path[0])
+ {
+ TALER_LOG_DEBUG ("Will delete path: %s\n",
+ delete_path);
return delete_object (con, hr);
+ }
+
/* response might have been modified. */
return MHD_queue_response (con,