Fix possible segfault if siglist was empty
If siglist->results wasn't a NULL pointer, we would try to free it anyway, even if siglist->count was zero. Only attempt to free this pointer if we had results and the pointer is valid. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
3a460a8be6
commit
5e7875ae6a
1 changed files with 4 additions and 1 deletions
|
@ -615,7 +615,10 @@ int SYMEXPORT alpm_siglist_cleanup(alpm_siglist_t *siglist)
|
||||||
free(result->key.fingerprint);
|
free(result->key.fingerprint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FREE(siglist->results);
|
if(siglist->count) {
|
||||||
|
free(siglist->results);
|
||||||
|
}
|
||||||
|
siglist->results = NULL;
|
||||||
siglist->count = 0;
|
siglist->count = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue