Re: cvs: php4 /ext/informix ifx.ec
| From: | Andi Gutmans | Date: | Tue, 05 Sep 2000 04:15:18 +0000 |
| Subject: | Re: cvs: php4 /ext/informix ifx.ec | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-1569@lists.php.net to get a copy of this message | ||
I just looked at the code briefly but is there any reason you don't emalloc() returnmsg instead of malloc()?
malloc() memory could leak at the end of the request if your script terminates unexpectedly.
Andi
At 09:18 PM 9/4/00 +0000, Danny Heijl wrote:
--- Andi Gutmans <andi@zend.com> http://www.zend.com/danny Mon Sep 4 14:18:06 2000 EDTModified files:/php4/ext/informix ifx.ecLog: - remove a memory leak warning and fix a crash when tempnam()failed for some reason (danny).Index: php4/ext/informix/ifx.ec diff -u php4/ext/informix/ifx.ec:1.47 php4/ext/informix/ifx.ec:1.48--- php4/ext/informix/ifx.ec:1.47 Sat Aug 12 05:03:39 2000 +++ php4/ext/informix/ifx.ec Mon Sep 4 14:18:06 2000@@ -20,7 +20,7 @@+----------------------------------------------------------------------+*/ -/* $Id: ifx.ec,v 1.47 2000/08/12 12:03:39 danny Exp $ */ +/* $Id: ifx.ec,v 1.48 2000/09/04 21:18:06 danny Exp $ */ /* ------------------------------------------------------------------- * if you want a function reference : "grep '^\*\*' ifx.ec" will give @@ -1805,11 +1805,16 @@ifx_errmsg[0] = 0; }- returnmsg = (char *) emalloc(strlen(ifx_errmsg) + 128); + returnmsg = (char *) malloc(strlen(ifx_errmsg) + 128); sprintf(returnmsg,ifx_errmsg, sqlca.sqlerrm); free(ifx_errmsg); + //RETURN_STRING(returnmsg,1); // can not use the macro, have to free the memory + return_value->value.str.len = strlen(returnmsg); + return_value->value.str.val = estrndup(returnmsg,return_value->value.str.len); + return_value->type = IS_STRING; + free(returnmsg); + return;- RETURN_STRING(returnmsg,0); /* do not dup, emalloced ! */} /* }}} */ @@ -3783,6 +3788,10 @@ sprintf(filename,"blb%d",(int)bid); blobfile=tempnam(blobdir,filename); free(blobdir); + + if (blobfile == NULL) + return NULL; + retval=emalloc(strlen(blobfile)+1); if(retval==NULL) return NULL; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-cvs-unsubscribe@lists.php.net For additional commands, e-mail: php-cvs-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net