From dd6cc1f83c1ba1c955587a439e58fee840ec5214 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 25 Apr 2008 10:57:35 +0200 Subject: [PATCH] Fix a segfault if we try to close a nullpointer. Same local or in the smb plugin. --- modules/csync_smb.c | 4 ++++ src/vio/csync_vio_local.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/modules/csync_smb.c b/modules/csync_smb.c index ece47ac19..8b1716c5a 100644 --- a/modules/csync_smb.c +++ b/modules/csync_smb.c @@ -104,6 +104,10 @@ static int _close(csync_vio_method_handle_t *fhandle) { int rc = -1; smb_fhandle_t *handle = NULL; + if (fhandle == NULL) { + return -1; + } + handle = (smb_fhandle_t *) fhandle; rc = smbc_close(handle->fd); diff --git a/src/vio/csync_vio_local.c b/src/vio/csync_vio_local.c index 51d5d42e3..2e6908c29 100644 --- a/src/vio/csync_vio_local.c +++ b/src/vio/csync_vio_local.c @@ -72,6 +72,10 @@ int csync_vio_local_close(csync_vio_method_handle_t *fhandle) { int rc = -1; fhandle_t *handle = NULL; + if (fhandle == NULL) { + return -1; + } + handle = (fhandle_t *) fhandle; rc = close(handle->fd);