]> granicus.if.org Git - php/commitdiff
- remove a memory leak warning and fix a crash when tempnam()
authorDanny Heijl <danny@php.net>
Mon, 4 Sep 2000 21:18:07 +0000 (21:18 +0000)
committerDanny Heijl <danny@php.net>
Mon, 4 Sep 2000 21:18:07 +0000 (21:18 +0000)
  failed for some reason (danny).

ext/informix/ifx.ec

index aa487a8aa8fb395a6f201f8d94956d93ddc348b7..9042e22bd52c2e6115d5ab4c403c7731227a35c6 100644 (file)
@@ -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;