Update of /cvsroot/monetdb/clients/src/mapiclient
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7227/src/mapiclient
Modified Files:
MapiClient.mx
Log Message:
hopefully fix a crash in case you do not have readline, have iconv
and need it!
Index: MapiClient.mx
===================================================================
RCS file: /cvsroot/monetdb/clients/src/mapiclient/MapiClient.mx,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- MapiClient.mx 11 Dec 2007 12:51:49 -0000 1.95
+++ MapiClient.mx 13 Dec 2007 15:44:24 -0000 1.96
@@ -1180,7 +1180,7 @@
doFileByLines(Mapi mid, FILE *fp, const char *prompt)
{
char *line = NULL;
- char *buf = NULL;
+ char *oldbuf = NULL, *buf = NULL;
size_t length;
MapiHdl hdl = mapi_get_active(mid);
MapiMsg rc = MOK;
@@ -1189,7 +1189,7 @@
#ifdef HAVE_LIBREADLINE
if (prompt == NULL)
#endif
- buf = malloc(BUFSIZ);
+ oldbuf = buf = malloc(BUFSIZ);
do {
#ifdef HAVE_LIBREADLINE
@@ -1224,6 +1224,7 @@
fflush(stdout);
}
#endif
+ buf = oldbuf;
line = fgets(buf, BUFSIZ, fp);
}
#ifdef HAVE_ICONV
@@ -1236,7 +1237,8 @@
line = to;
iconv(cd_in, &from, &fromlen, &to, &tolen);
*to = 0;
- free(buf);
+ if (oldbuf)
+ free(buf);
buf = line;
}
#endif
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins