summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/conn.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index 38fa2e0237..2a77e23e73 100644
--- a/source3/smbd/conn.c
+++ b/source3/smbd/conn.c
@@ -201,15 +201,18 @@ void conn_free(connection_struct *conn)
/* Free vfs_connection_struct */
handle = conn->vfs_private;
while(handle) {
- /* Close dlopen() handle */
- done_fptr = (void (*)(connection_struct *))sys_dlsym(handle->handle, "vfs_done");
-
- if (done_fptr == NULL) {
- DEBUG(3, ("No vfs_done() symbol found in module with handle %p, ignoring\n", handle->handle));
- } else {
- done_fptr(conn);
- }
- sys_dlclose(handle->handle);
+ if (handle->handle) {
+ /* Close dlopen() handle */
+ done_fptr = (void (*)(connection_struct *))sys_dlsym(handle->handle, "vfs_done");
+
+ if (done_fptr == NULL) {
+ DEBUG(3, ("No vfs_done() symbol found in module with handle %p, ignoring\n", handle->handle));
+ } else {
+ done_fptr(conn);
+ }
+ sys_dlclose(handle->handle);
+ }
+
DLIST_REMOVE(conn->vfs_private, handle);
thandle = handle->next;
SAFE_FREE(handle);