From 5e7875ae6a42de40e3a7432ea758b27397a11aa7 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 21 Sep 2011 19:13:43 -0500 Subject: 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 --- lib/libalpm/signing.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index e1b6452c..b090b6a9 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -615,7 +615,10 @@ int SYMEXPORT alpm_siglist_cleanup(alpm_siglist_t *siglist) free(result->key.fingerprint); } } - FREE(siglist->results); + if(siglist->count) { + free(siglist->results); + } + siglist->results = NULL; siglist->count = 0; return 0; } -- cgit v1.2.3-24-g4f1b