Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30509
Modified Files:
Tag: SQL_2-22
merovingian.mx
Log Message:
Fix a crapload of memory leaks reported by valgrind. Most of the leaks were in
the handleClient function, which made merovingian rapidly gain weight under
stress testing...
U merovingian.mx
Index: merovingian.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian.mx,v
retrieving revision 1.22.2.15
retrieving revision 1.22.2.16
diff -u -d -r1.22.2.15 -r1.22.2.16
--- merovingian.mx 17 Apr 2008 08:20:54 -0000 1.22.2.15
+++ merovingian.mx 18 Apr 2008 14:09:10 -0000 1.22.2.16
@@ -658,8 +658,9 @@
err e = newErr("client challenge error: %s", buf);
stream_printf(fout, "!incomplete challenge '%s'\n", user);
stream_flush(fout);
- stream_close(fout);
- stream_close(fdin);
+ close_stream(fout);
+ close_stream(fdin);
+ bstream_destroy(fin);
return(e);
}
@@ -673,8 +674,9 @@
err e = newErr("client challenge error: %s", buf);
stream_printf(fout, "!invalid password entry\n");
stream_flush(fout);
- stream_close(fout);
- stream_close(fdin);
+ close_stream(fout);
+ close_stream(fdin);
+ bstream_destroy(fin);
return(e);
}
algo = passwd + 1;
@@ -683,8 +685,9 @@
err e = newErr("client challenge error: %s", buf);
stream_printf(fout, "!invalid password entry\n");
stream_flush(fout);
- stream_close(fout);
- stream_close(fdin);
+ close_stream(fout);
+ close_stream(fdin);
+ bstream_destroy(fin);
return(e);
}
*s = 0;
@@ -693,8 +696,9 @@
err e = newErr("client challenge error: %s", buf);
stream_printf(fout, "!incomplete challenge '%s'\n", user);
stream_flush(fout);
- stream_close(fout);
- stream_close(fdin);
+ close_stream(fout);
+ close_stream(fdin);
+ bstream_destroy(fin);
return(e);
}
@@ -707,8 +711,9 @@
err e = newErr("client challenge error: %s", buf);
stream_printf(fout, "!incomplete challenge, missing
language\n");
stream_flush(fout);
- stream_close(fout);
- stream_close(fdin);
+ close_stream(fout);
+ close_stream(fdin);
+ bstream_destroy(fin);
return(e);
}
@@ -728,8 +733,9 @@
* complain */
stream_printf(fout, "!please specify a database\n");
stream_flush(fout);
- stream_close(fout);
- stream_close(fdin);
+ close_stream(fout);
+ close_stream(fdin);
+ bstream_destroy(fin);
return(newErr("no database specified"));
} else {
err e = forkMserver(database, &top, 0);
@@ -740,8 +746,9 @@
stream_printf(fout, "!internal error while
starting a new mserver\n");
}
stream_flush(fout);
- stream_close(fout);
- stream_close(fdin);
+ close_stream(fout);
+ close_stream(fdin);
+ bstream_destroy(fin);
return(e);
}
stat = top;
@@ -752,8 +759,9 @@
err e = newErr("database '%s' does not allow connections",
stat->dbname);
stream_printf(fout, "!database '%s' does not allow
connections\n", stat->dbname);
stream_flush(fout);
- stream_close(fout);
- stream_close(fdin);
+ close_stream(fout);
+ close_stream(fdin);
+ bstream_destroy(fin);
SABAOTHfreeStatus(&top);
return(e);
}
@@ -783,8 +791,9 @@
stat->conns->val, stat->dbname);
/* flush redirect and return */
stream_flush(fout);
- stream_close(fout);
- stream_close(fdin);
+ close_stream(fout);
+ close_stream(fdin);
+ bstream_destroy(fin);
SABAOTHfreeStatus(&top);
return(NO_ERR);
@@ -1151,7 +1160,7 @@
errlog = NULL;
timeout = 0;
pidfilename = NULL;
- prefix = MONETDB5_PREFIX;
+ prefix = GDKstrdup(MONETDB5_PREFIX);
while (fgets(buf, 1024, cnf) != NULL) {
/* eliminate fgets' newline */
buf[strlen(buf) - 1] = '\0';
@@ -1159,6 +1168,7 @@
/* this should always come before it's used, so it's
safe
* this way */
p = strchr(buf, '=');
+ GDKfree(prefix);
prefix = GDKstrdup(++p);
} else if (*buf && strncmp(buf, "gdk_dbfarm=", 11) == 0) {
p = strchr(buf, '=');
@@ -1213,6 +1223,10 @@
return(1);
}
+ /* we no longer need prefix */
+ GDKfree(prefix);
+ prefix = NULL;
+
/* we need a dbfarm */
if (dbfarm == NULL) {
fprintf(stderr, "cannot find dbfarm via config file\n");
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins