From daab2741d4608c5a8896efd2d12e67773793712f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Sat, 23 Apr 2011 14:44:10 +0000 Subject: check that return value of magic_open() isn't NULL before trying to use it --- xfile.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xfile.h b/xfile.h index 7c26e66..c915e28 100644 --- a/xfile.h +++ b/xfile.h @@ -90,8 +90,7 @@ static xFile xOpen(const char *path) { lzma_ret ret = LZMA_OK; const char *message, *tmp; magic_t cookie; - cookie = magic_open(MAGIC_NONE); - if(!magic_load(cookie, NULL)) { + if ((cookie = magic_open(MAGIC_NONE)) && !magic_load(cookie, NULL)) { message = magic_file(cookie, path); if(message == NULL) xF.type = XF_FAIL; -- cgit v1.2.1