Skip to content
Snippets Groups Projects
Commit 19589bb9 authored by deuce's avatar deuce
Browse files

Fix crazy big memory leak in new (currently unused) strListCmp() function.

parent eb9dc676
No related branches found
No related tags found
No related merge requests found
...@@ -394,30 +394,49 @@ int DLLCALL strListCmp(str_list_t list1, str_list_t list2) ...@@ -394,30 +394,49 @@ int DLLCALL strListCmp(str_list_t list1, str_list_t list2)
{ {
str_list_t l1=strListDup(list1); str_list_t l1=strListDup(list1);
str_list_t l2=strListDup(list2); str_list_t l2=strListDup(list2);
str_list_t ol1=l1;
str_list_t ol2=l2;
int tmp; int tmp;
int ret;
if(*l1 == NULL && *l2 == NULL) if(*l1 == NULL && *l2 == NULL) {
return 0; ret=0;
if(*l1 == NULL) goto early_return;
return -1; }
if(*l2 == NULL) if(*l1 == NULL) {
return 1; ret = -1;
goto early_return;
}
if(*l2 == NULL) {
ret = 1;
goto early_return;
}
strListSortAlphaCase(l1); strListSortAlphaCase(l1);
strListSortAlphaCase(l2); strListSortAlphaCase(l2);
for(; *l1; l1++) { for(; *l1; l1++) {
l2++; l2++;
if(*l2==NULL) if(*l2==NULL) {
return 1; ret=1;
goto early_return;
}
tmp = strcmp(*l1, *l2); tmp = strcmp(*l1, *l2);
if(tmp != 0) if(tmp != 0) {
return tmp; ret=tmp;
goto early_return;
}
} }
l2++; l2++;
if(*l2==NULL) if(*l2==NULL)
return 0; ret=0;
return -1; else
ret=-1;
early_return:
strListFree(&ol1);
strListFree(&ol2);
return ret;
} }
void DLLCALL strListFreeStrings(str_list_t list) void DLLCALL strListFreeStrings(str_list_t list)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment