]> granicus.if.org Git - php/commitdiff
fix leaks on error
authorAntony Dovgal <tony2001@php.net>
Thu, 1 Feb 2007 13:45:25 +0000 (13:45 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 1 Feb 2007 13:45:25 +0000 (13:45 +0000)
ext/standard/string.c

index 34609bcdb14093539774cfac8367d4ed9be60151..70d26264e8531b131fc7f23e826b36b331a2cac2 100644 (file)
@@ -1881,6 +1881,8 @@ PHP_FUNCTION(strripos)
 
        if (offset >= 0) {
                if (offset > haystack_len) {
+                       efree(needle_dup);
+                       efree(haystack_dup);
                        php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Offset is greater than the length of haystack string");
                        RETURN_FALSE;
                }
@@ -1888,6 +1890,8 @@ PHP_FUNCTION(strripos)
                e = haystack_dup + haystack_len - needle_len;
        } else {
                if (-offset > haystack_len) {
+                       efree(needle_dup);
+                       efree(haystack_dup);
                        php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Offset is greater than the length of haystack string");
                        RETURN_FALSE;
                }