diff options
author | Danny Heijl <danny@php.net> | 2000-09-04 21:18:07 +0000 |
---|---|---|
committer | Danny Heijl <danny@php.net> | 2000-09-04 21:18:07 +0000 |
commit | 95d92b8be0eab6dd2aa54792371afc19faf05f69 (patch) | |
tree | 2c9de9b54a6636ab869516157ebaa785d46bec04 /ext/informix | |
parent | 388170ffa591df1ecaf780daa65a358037094b9e (diff) | |
download | php-git-95d92b8be0eab6dd2aa54792371afc19faf05f69.tar.gz |
- remove a memory leak warning and fix a crash when tempnam()
failed for some reason (danny).
Diffstat (limited to 'ext/informix')
-rw-r--r-- | ext/informix/ifx.ec | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/informix/ifx.ec b/ext/informix/ifx.ec index aa487a8aa8..9042e22bd5 100644 --- a/ext/informix/ifx.ec +++ b/ext/informix/ifx.ec @@ -1805,11 +1805,16 @@ PHP_FUNCTION(ifx_errormsg) 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 @@ static char* php3_intifx_create_tmpfile(long bid) { 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; |