]> Sergey Matveev's repositories - bfs.git/commitdiff
bfstd: Only free the locale if we dup'd it successfully
authorTavian Barnes <tavianator@tavianator.com>
Thu, 26 Oct 2023 14:57:25 +0000 (10:57 -0400)
committerTavian Barnes <tavianator@tavianator.com>
Thu, 26 Oct 2023 14:57:25 +0000 (10:57 -0400)
src/bfstd.c

index ace9ed27c5e9b891573166e7229f4ee572eeef16..cdc33f18a718206523e2b3670e6717847538e086 100644 (file)
@@ -302,10 +302,10 @@ const char *xstrerror(int errnum) {
 
        if (copy != (locale_t)0) {
                ret = strerror_l(errnum, copy);
-       }
 
-       if (loc == LC_GLOBAL_LOCALE) {
-               freelocale(copy);
+               if (loc == LC_GLOBAL_LOCALE) {
+                       freelocale(copy);
+               }
        }
 #endif