From dc8bffd5a0f7c91946d4123e1d4d6b3597166eb7 Mon Sep 17 00:00:00 2001 From: Al Date: Sun, 21 Jan 2018 01:20:30 -0500 Subject: [PATCH] [fix] expansion test valgrind errors for #308 --- test/test_expand.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/test_expand.c b/test/test_expand.c index 582f67f0..12e70369 100644 --- a/test/test_expand.c +++ b/test/test_expand.c @@ -31,8 +31,6 @@ static greatest_test_res test_expansion_contains_phrase_option(char *input, char } - libpostal_expansion_array_destroy(expansions, num_expansions); - if (!contains_expansion) { printf("Expansions should contain %s, got {", output); for (size_t i = 0; i < num_expansions; i++) { @@ -43,6 +41,8 @@ static greatest_test_res test_expansion_contains_phrase_option(char *input, char FAIL(); } + libpostal_expansion_array_destroy(expansions, num_expansions); + PASS(); } @@ -143,7 +143,8 @@ TEST test_expansion_for_non_address_input(void) { size_t num_expansions; // This is tested as the input caused a segfault in expand_alternative_phrase_option - libpostal_expand_address("ida-b@wells.co", libpostal_get_default_options(), &num_expansions); + char **expansions = libpostal_expand_address("ida-b@wells.co", libpostal_get_default_options(), &num_expansions); + libpostal_expansion_array_destroy(expansions, num_expansions); PASS(); }