This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Stop Coverity warning
authorKarl Williamson <khw@cpan.org>
Wed, 7 Aug 2019 03:29:22 +0000 (21:29 -0600)
committerKarl Williamson <khw@cpan.org>
Wed, 7 Aug 2019 03:33:00 +0000 (21:33 -0600)
Coverity is right, so re-order these clauses.  This code is executed
only if some very strange error occurs.

locale.c

index db83d99..af7af60 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -4349,11 +4349,6 @@ Perl__mem_collxfrm(pTHX_ const char *input_string,
     return xbuf;
 
   bad:
-    Safefree(xbuf);
-    if (s != input_string) {
-        Safefree(s);
-    }
-    *xlen = 0;
 
 #  ifdef DEBUGGING
 
@@ -4363,6 +4358,12 @@ Perl__mem_collxfrm(pTHX_ const char *input_string,
 
 #  endif
 
+    Safefree(xbuf);
+    if (s != input_string) {
+        Safefree(s);
+    }
+    *xlen = 0;
+
     return NULL;
 }