related to fix #24 - reinserted NULL checks on return values and ensured that all duped memory was freed upon errors.
1.1 --- a/src/stringlist.c Sun Jul 17 11:45:36 2016 +0200
1.2 +++ b/src/stringlist.c Sun Jul 17 11:51:49 2016 +0200
1.3 @@ -41,6 +41,10 @@
1.4
1.5 while (src_curr) {
1.6 *dst_curr_ptr = new_stringlist(src_curr->value);
1.7 + if (*dst_curr_ptr == NULL) {
1.8 + free_stringlist(dst);
1.9 + return NULL;
1.10 + }
1.11 src_curr = src_curr->next;
1.12 dst_curr_ptr = &((*dst_curr_ptr)->next);
1.13 }
2.1 --- a/src/stringpair.c Sun Jul 17 11:45:36 2016 +0200
2.2 +++ b/src/stringpair.c Sun Jul 17 11:51:49 2016 +0200
2.3 @@ -85,7 +85,16 @@
2.4
2.5 while (src_curr) {
2.6 copy_pair = stringpair_dup(src_curr->value);
2.7 + if (copy_pair == NULL) {
2.8 + free_stringpair_list(dst);
2.9 + return NULL;
2.10 + }
2.11 *dst_curr_ptr = new_stringpair_list(copy_pair);
2.12 + if (*dst_curr_ptr == NULL) {
2.13 + free_stringpair(copy_pair);
2.14 + free_stringpair_list(dst);
2.15 + return NULL;
2.16 + }
2.17 src_curr = src_curr->next;
2.18 dst_curr_ptr = &((*dst_curr_ptr)->next);
2.19 }