[dovecot-cvs] dovecot/src/imap-login client.c,1.5,1.6 client.h,1.2,1.3

cras at procontrol.fi cras at procontrol.fi
Tue Feb 11 18:56:38 EET 2003


Update of /home/cvs/dovecot/src/imap-login
In directory danu:/tmp/cvs-serv2094/imap-login

Modified Files:
	client.c client.h 
Log Message:
Make sure calling client_destroy() multiple times doesn't break anything.



Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap-login/client.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- client.c	8 Feb 2003 14:09:27 -0000	1.5
+++ client.c	11 Feb 2003 16:56:36 -0000	1.6
@@ -362,12 +362,18 @@
 
 void client_destroy(struct imap_client *client, const char *reason)
 {
+	if (client->destroyed)
+		return;
+	client->destroyed = TRUE;
+
 	if (reason != NULL)
 		client_syslog(client, reason);
 
 	hash_remove(clients, client);
 
 	imap_parser_destroy(client->parser);
+	client->parser = NULL;
+
 	i_stream_close(client->input);
 	o_stream_close(client->output);
 
@@ -381,7 +387,6 @@
 		client->common.fd = -1;
 	}
 
-	i_free(client->common.virtual_user);
 	client_unref(client);
 }
 
@@ -399,6 +404,7 @@
 	o_stream_unref(client->output);
 
 	buffer_free(client->plain_login);
+	i_free(client->common.virtual_user);
 	i_free(client);
 
 	main_unref();

Index: client.h
===================================================================
RCS file: /home/cvs/dovecot/src/imap-login/client.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- client.h	2 Feb 2003 10:46:20 -0000	1.2
+++ client.h	11 Feb 2003 16:56:36 -0000	1.3
@@ -25,6 +25,7 @@
 	unsigned int tls:1;
 	unsigned int cmd_finished:1;
 	unsigned int skip_line:1;
+	unsigned int destroyed:1;
 };
 
 struct client *client_create(int fd, struct ip_addr *ip, int ssl);




More information about the dovecot-cvs mailing list