]> 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 23:01:40 +0000 (23:01 +0000)
committerScott MacVicar <scottmac@php.net>
Thu, 29 Jan 2009 23:01:40 +0000 (23:01 +0000)
ext/mbstring/mbstring.c

index 42d132499259f0876f07901a44246fb69b8b9718..5c3255b8298bd378c59aec0b2af2559b459e462c 100644 (file)
@@ -3018,6 +3018,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;
                                }
                        }
@@ -3027,6 +3028,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;
                                }
                        }