From 38c6c26146762f964d06ab15667ab50c2dcbbf90 Mon Sep 17 00:00:00 2001 From: Al Date: Thu, 9 Feb 2017 14:33:13 -0500 Subject: [PATCH 1/2] [fix] freeing normalized string in address_parser_parse --- src/address_parser.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/address_parser.c b/src/address_parser.c index 187bada5..bb8e2f31 100644 --- a/src/address_parser.c +++ b/src/address_parser.c @@ -942,6 +942,10 @@ address_parser_response_t *address_parser_parse(char *address, char *language, c tokenized_string_destroy(tokenized_str); cstring_array_destroy(token_labels); + if (is_normalized) { + free(normalized); + } + return response; } From ea168279bd5a0040e10fcbe3bf854d9a113690e7 Mon Sep 17 00:00:00 2001 From: Al Date: Thu, 9 Feb 2017 14:34:15 -0500 Subject: [PATCH 2/2] [fix] free json-encoded string in parser client output --- src/address_parser_cli.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/address_parser_cli.c b/src/address_parser_cli.c index 1564cee6..7f2a3cce 100644 --- a/src/address_parser_cli.c +++ b/src/address_parser_cli.c @@ -118,6 +118,7 @@ int main(int argc, char **argv) { for (int i = 0; i < parsed->num_components; i++) { char *json_string = json_encode_string(parsed->components[i]); printf(" \"%s\": %s%s\n", parsed->labels[i], json_string, i < parsed->num_components - 1 ? "," : ""); + free(json_string); } printf("}\n"); printf("\n");