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>
This commit is contained in:
Andrew Gregory 2017-05-10 18:54:53 -04:00 committed by Allan McRae
parent f4e2009e9b
commit 1bc79cb9a5

View file

@ -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);