r12309: fix a crash bug, which appens in an error case
authorStefan Metzmacher <metze@samba.org>
Sat, 17 Dec 2005 19:24:13 +0000 (19:24 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:47:28 +0000 (13:47 -0500)
metze
(This used to be commit 292bb4b6cb600ce286ded90d32d72123fdaae1d7)

source4/wrepl_server/wrepl_out_push.c

index d3e4bdb44b69e15f2fe2c0f0a8c3fef6d3d7f40f..0afa6c570428c924e9516d8425e182fc431e5b5d 100644 (file)
@@ -40,19 +40,20 @@ static void wreplsrv_out_partner_push(struct wreplsrv_partner *partner, BOOL pro
 static void wreplsrv_push_handler_creq(struct composite_context *creq)
 {
        struct wreplsrv_partner *partner = talloc_get_type(creq->async.private_data, struct wreplsrv_partner);
+       struct wreplsrv_push_notify_io *old_notify_io;
 
        partner->push.last_status = wreplsrv_push_notify_recv(partner->push.creq);
        partner->push.creq = NULL;
-       talloc_free(partner->push.notify_io);
-       partner->push.notify_io = NULL;
-
        partner->push.last_run = timeval_current();
 
+       old_notify_io = partner->push.notify_io;
+       partner->push.notify_io = NULL;
+
        if (NT_STATUS_IS_OK(partner->push.last_status)) {
                partner->push.error_count = 0;
                DEBUG(2,("wreplsrv_push_notify(%s): %s\n",
                         partner->address, nt_errstr(partner->push.last_status)));
-               return;
+               goto done;
        }
 
        partner->push.error_count++;
@@ -61,13 +62,15 @@ static void wreplsrv_push_handler_creq(struct composite_context *creq)
                DEBUG(1,("wreplsrv_push_notify(%s): %s: error_count: %u: giving up\n",
                         partner->address, nt_errstr(partner->push.last_status),
                         partner->push.error_count));
-               return;
+               goto done;
        }
 
        DEBUG(1,("wreplsrv_push_notify(%s): %s: error_count: %u: retry\n",
                 partner->address, nt_errstr(partner->push.last_status),
                 partner->push.error_count));
-       wreplsrv_out_partner_push(partner, partner->push.notify_io->in.propagate);
+       wreplsrv_out_partner_push(partner, old_notify_io->in.propagate);
+done:
+       talloc_free(old_notify_io);
 }
 
 static void wreplsrv_out_partner_push(struct wreplsrv_partner *partner, BOOL propagate)