summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2017-05-01 21:21:28 +0200
committerAndrew Gregory <andrew.gregory.8@gmail.com>2017-05-11 00:50:34 +0200
commit48ed9b33812ab81ef5c4e58255dc7464cef443bc (patch)
tree18f115250ccea303894cb1ab567ba19cea1b125c
parent45459eebae0b0427dce582985c7c5895da78b7c2 (diff)
downloadpacman-48ed9b33812ab81ef5c4e58255dc7464cef443bc.tar.gz
pacman-48ed9b33812ab81ef5c4e58255dc7464cef443bc.tar.xz
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>
-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);