svn commit: samba r12247 - in branches/SAMBA_4_0/source/libcli/wrepl: .

metze at samba.org metze at samba.org
Wed Dec 14 21:27:30 GMT 2005


Author: metze
Date: 2005-12-14 21:27:29 +0000 (Wed, 14 Dec 2005)
New Revision: 12247

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12247

Log:
- reject freeing the wrepl_socket inside of wrepl_socket_dead()
- free it at the end of wrepl_socket_dead() if needed

metze
Modified:
   branches/SAMBA_4_0/source/libcli/wrepl/winsrepl.c
   branches/SAMBA_4_0/source/libcli/wrepl/winsrepl.h


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/wrepl/winsrepl.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/wrepl/winsrepl.c	2005-12-14 20:39:45 UTC (rev 12246)
+++ branches/SAMBA_4_0/source/libcli/wrepl/winsrepl.c	2005-12-14 21:27:29 UTC (rev 12247)
@@ -35,7 +35,6 @@
 */
 static void wrepl_socket_dead(struct wrepl_socket *wrepl_socket, NTSTATUS status)
 {
-	talloc_set_destructor(wrepl_socket, NULL);
 	wrepl_socket->dead = True;
 
 	if (wrepl_socket->packet) {
@@ -62,6 +61,11 @@
 		DLIST_REMOVE(wrepl_socket->recv_queue, req);
 		wrepl_request_finished(req, status);
 	}
+
+	talloc_set_destructor(wrepl_socket, NULL);
+	if (wrepl_socket->free_skipped) {
+		talloc_free(wrepl_socket);
+	}
 }
 
 static void wrepl_request_timeout_handler(struct event_context *ev, struct timed_event *te,
@@ -135,6 +139,10 @@
 static int wrepl_socket_destructor(void *ptr)
 {
 	struct wrepl_socket *sock = talloc_get_type(ptr, struct wrepl_socket);
+	if (sock->dead) {
+		sock->free_skipped = True;
+		return -1;
+	}
 	wrepl_socket_dead(sock, NT_STATUS_LOCAL_DISCONNECT);
 	return 0;
 }

Modified: branches/SAMBA_4_0/source/libcli/wrepl/winsrepl.h
===================================================================
--- branches/SAMBA_4_0/source/libcli/wrepl/winsrepl.h	2005-12-14 20:39:45 UTC (rev 12246)
+++ branches/SAMBA_4_0/source/libcli/wrepl/winsrepl.h	2005-12-14 21:27:29 UTC (rev 12247)
@@ -47,6 +47,9 @@
 
 	/* remember is the socket is dead */
 	BOOL dead;
+
+	/* remember if we need to free the wrepl_socket at the end of wrepl_socket_dead() */
+	BOOL free_skipped;
 };
 
 struct wrepl_send_ctrl {



More information about the samba-cvs mailing list