This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Leaked string in failure path.
authorJarkko Hietaniemi <jhi@iki.fi>
Wed, 7 May 2014 13:22:16 +0000 (09:22 -0400)
committerSteffen Mueller <smueller@cpan.org>
Wed, 28 May 2014 17:27:21 +0000 (19:27 +0200)
Fix for Coverity perl5 CID 29058: Resource leak
(RESOURCE_LEAK) leaked_storage: Variable codeset going out of scope leaks the
storage it points to.

The savepv-ed codeset was not freed in failure path.
(The save_input_locale is freed just few lines later.)

locale.c

index 66524e6..56cac85 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -1077,6 +1077,7 @@ S_is_cur_LC_category_utf8(pTHX_ int category)
                 Safefree(save_input_locale);
                 return is_utf8;
             }
+            Safefree(codeset);
         }
 
 #   endif