summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2017-05-10 18:54:53 -0400
committerAllan McRae <allan@archlinux.org>2017-05-16 12:38:58 +1000
commit1bc79cb9a5067d685ba507fad9b189ed28ad70a0 (patch)
tree3a912815fdddc789ae139059df107b2c6ab950ff
parentf4e2009e9b01a3ebff8b54e059d4f0422a139016 (diff)
alpm_unlock: check handle before dereferencing
Prevents SIGSEGV if we catch SIGINT or SIGHUP before initializing alpm. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--lib/libalpm/handle.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 502a5d9e..08625e3a 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -135,6 +135,7 @@ int _alpm_handle_lock(alpm_handle_t *handle)
*/
int SYMEXPORT alpm_unlock(alpm_handle_t *handle)
{
+ ASSERT(handle != NULL, return -1);
ASSERT(handle->lockfile != NULL, return 0);
ASSERT(handle->lockfd >= 0, return 0);