]> granicus.if.org Git - php/commitdiff
MFB Fix bug #47245 - Double free in mb_detect_encoding()
authorScott MacVicar <scottmac@php.net>
Thu, 29 Jan 2009 22:59:57 +0000 (22:59 +0000)
committerScott MacVicar <scottmac@php.net>
Thu, 29 Jan 2009 22:59:57 +0000 (22:59 +0000)
ext/mbstring/mbstring.c

index e26bbbebc47b1dc3e8fb9b0d6b460fd8fbe4bec7..471dbdb3ab86e7eada1694ab894d26b641603ee5 100644 (file)
@@ -3187,6 +3187,7 @@ PHP_FUNCTION(mb_detect_encoding)
                        if (!php_mb_parse_encoding_array(encoding_list, &list, &size, 0 TSRMLS_CC)) {
                                if (list) {
                                        efree(list);
+                                       list = NULL;
                                        size = 0;
                                }
                        }
@@ -3196,6 +3197,7 @@ PHP_FUNCTION(mb_detect_encoding)
                        if (!php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRLEN_P(encoding_list), &list, &size, 0 TSRMLS_CC)) {
                                if (list) {
                                        efree(list);
+                                       list = NULL;
                                        size = 0;
                                }
                        }