From 52cf237b1d4a2f1d6f5541f3cdbcced95ff6f5ff Mon Sep 17 00:00:00 2001 From: Noel Power Date: Wed, 22 May 2019 14:07:44 +0000 Subject: [PATCH] s3/modules: cppcheck: Fix ctunullpointer error Fixes source3/modules/vfs_syncops.c:117: error: ctunullpointer: Null pointer dereference: smb_fname <--[cppcheck] Signed-off-by: Noel Power Reviewed-by: Andreas Schneider --- source3/modules/vfs_syncops.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source3/modules/vfs_syncops.c b/source3/modules/vfs_syncops.c index f94588c60ed..0a51fdf6e7a 100644 --- a/source3/modules/vfs_syncops.c +++ b/source3/modules/vfs_syncops.c @@ -113,11 +113,13 @@ static void syncops_two_names(const char *name1, const char *name2) */ static void syncops_smb_fname(const struct smb_filename *smb_fname) { - char *parent; - parent = parent_dir(NULL, smb_fname->base_name); - if (parent) { - syncops_sync_directory(parent); - talloc_free(parent); + char *parent = NULL; + if (smb_fname != NULL) { + parent = parent_dir(NULL, smb_fname->base_name); + if (parent != NULL) { + syncops_sync_directory(parent); + talloc_free(parent); + } } } -- 2.47.3