Ensure we always free aio_ex on all error paths by moving the TALLOC_FREE
authorJeremy Allison <jra@samba.org>
Thu, 12 Jan 2012 00:37:48 +0000 (16:37 -0800)
committerJeremy Allison <jra@samba.org>
Thu, 12 Jan 2012 02:10:52 +0000 (03:10 +0100)
call out of smbd_aio_complete_aio_ex() and into the caller.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Jan 12 03:10:52 CET 2012 on sn-devel-104

source3/modules/vfs_aio_fork.c
source3/modules/vfs_aio_pthread.c
source3/smbd/aio.c

index 01eb97de867354cf8b84a7dfb106ca9e62ff7471..bcd7c6ae2d0cb506ca1240435dd01abd5d2a980e 100644 (file)
@@ -434,6 +434,7 @@ static void handle_aio_completion(struct event_context *event_ctx,
 
        aio_ex = (struct aio_extra *)child->aiocb->aio_sigevent.sigev_value.sival_ptr;
        smbd_aio_complete_aio_ex(aio_ex);
+       TALLOC_FREE(aio_ex);
 }
 
 static int aio_child_destructor(struct aio_child *child)
index 82611b0a7b7a535db044ad5b41a28a36ae14846e..b6d4e1ef35e5161196aa1f45e3a9f150cc727409 100644 (file)
@@ -296,7 +296,7 @@ static void aio_pthread_handle_completion(struct event_context *event_ctx,
 
        DEBUG(10,("aio_pthread_handle_completion: jobid %d completed\n",
                jobid ));
-
+       TALLOC_FREE(aio_ex);
 }
 
 /************************************************************************
@@ -424,6 +424,7 @@ static void aio_pthread_handle_immediate(struct tevent_context *ctx,
        TALLOC_FREE(pjobid);
        aio_ex = (struct aio_extra *)pd->aiocb->aio_sigevent.sigev_value.sival_ptr;
        smbd_aio_complete_aio_ex(aio_ex);
+       TALLOC_FREE(aio_ex);
 }
 
 /************************************************************************
index 07b8388fba0692600e4c07c6c8d4e915d30d9e95..44081f69a0148720272ecb843bc542400a2711f6 100644 (file)
@@ -67,6 +67,7 @@ static void smbd_aio_signal_handler(struct tevent_context *ev_ctx,
                                info->si_value.sival_ptr;
 
        smbd_aio_complete_aio_ex(aio_ex);
+       TALLOC_FREE(aio_ex);
 }
 
 
@@ -931,8 +932,6 @@ void smbd_aio_complete_aio_ex(struct aio_extra *aio_ex)
        if (!handle_aio_completed(aio_ex, &ret)) {
                return;
        }
-
-       TALLOC_FREE(aio_ex);
 }
 
 /****************************************************************************