From f8807a4216ede625447f348f566d10aa69eaa2ed Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Thu, 4 Jan 2018 07:50:44 +0000
Subject: [PATCH] (dir.c) Cleanup potential null pointer dereference warning
Found by GCC 7.2.0.
dir.c:653:31: warning: potential null pointer dereference [-Wnull-dereference]
if (IS_PATH_SEP (vpath_str[0]) && vpath_str[1] == '\0')
../../lib/global.h:132:26: note: in definition of macro 'IS_PATH_SEP'
#define IS_PATH_SEP(c) ((c) == PATH_SEP)
^
Signed-off-by: Andreas Mohr <and@gmx.li>
---
src/filemanager/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/filemanager/dir.c b/src/filemanager/dir.c
index 2482c8625..62b826ab2 100644
a
|
b
|
dir_list_load (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort, |
650 | 650 | |
651 | 651 | vpath_str = vfs_path_as_str (vpath); |
652 | 652 | /* Do not add a ".." entry to the root directory */ |
653 | | if (IS_PATH_SEP (vpath_str[0]) && vpath_str[1] == '\0') |
| 653 | if (vpath_str != NULL && IS_PATH_SEP (vpath_str[0]) && vpath_str[1] == '\0') |
654 | 654 | dir_list_clean (list); |
655 | 655 | |
656 | 656 | while ((dp = mc_readdir (dirp)) != NULL) |