]> granicus.if.org Git - php/commitdiff
Backported memory leak fixes from the 4.3 branch
authorIlia Alshanetsky <iliaa@php.net>
Sat, 17 Aug 2002 16:47:54 +0000 (16:47 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sat, 17 Aug 2002 16:47:54 +0000 (16:47 +0000)
ext/standard/pack.c

index 029e6212129abeb7dde2f2f18dc4345ea6725c4f..3d47e0609cb18086eab7525252687cad27042418 100644 (file)
@@ -209,6 +209,9 @@ PHP_FUNCTION(pack)
                                break;
 
                        default:
+                               efree(argv);
+                               efree(formatcodes);
+                               efree(formatargs);
                                php_error(E_WARNING, "pack type %c: unknown format code", code);
                                RETURN_FALSE;
                }
@@ -518,7 +521,7 @@ PHP_FUNCTION(unpack)
        inputpos = 0;
 
        if (array_init(return_value) == FAILURE)
-               return;
+               RETURN_FALSE;
 
        while (formatlen-- > 0) {
                char type = *(format++);
@@ -809,6 +812,7 @@ PHP_FUNCTION(unpack)
                                break;
                        } else {
                                php_error(E_WARNING, "pack type %c: not enough input, need %d, have %d", type, size, inputlen - inputpos);
+                               zval_dtor(return_value);
                                RETURN_FALSE;
                        }
                }