[dovecot-cvs] dovecot/src/auth db-mysql.c,1.6,1.7

cras at dovecot.org cras at dovecot.org
Fri Jul 23 06:23:20 EEST 2004


Update of /home/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv30234

Modified Files:
	db-mysql.c 
Log Message:
MySQL reconnection memleak fix.



Index: db-mysql.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/db-mysql.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- db-mysql.c	18 Jul 2004 12:40:57 -0000	1.6
+++ db-mysql.c	23 Jul 2004 03:23:18 -0000	1.7
@@ -97,21 +97,19 @@
 			i_error("MySQL: mysql_init failed");
 			return FALSE;
 		}
+	}
 
-		if (!mysql_real_connect(conn->mysql, conn->set.db_host,
-					conn->set.db_user, conn->set.db_passwd,
-					conn->set.db,
-					conn->set.db_port,
-					conn->set.db_unix_socket,
-					conn->set.db_client_flags)) {
-			i_error("MySQL: Can't connect to database %s: %s",
-				conn->set.db, mysql_error(conn->mysql));
-			conn->connected = FALSE;
-			conn->mysql = NULL;
-		} else {
-			conn->connected = TRUE;
-			i_info("MySQL: connected to %s", conn->set.db_host);
-		}
+	if (mysql_real_connect(conn->mysql, conn->set.db_host,
+			       conn->set.db_user, conn->set.db_passwd,
+			       conn->set.db,
+			       conn->set.db_port,
+			       conn->set.db_unix_socket,
+			       conn->set.db_client_flags) == NULL) {
+		i_error("MySQL: Can't connect to database %s: %s",
+			conn->set.db, mysql_error(conn->mysql));
+	} else {
+		conn->connected = TRUE;
+		i_info("MySQL: connected to %s", conn->set.db_host);
 	}
 	
 	return conn->connected;



More information about the dovecot-cvs mailing list