]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
intl: Fix a small memory leak.
authorBruno Haible <bruno@clisp.org>
Sun, 3 Aug 2025 17:34:19 +0000 (19:34 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 3 Aug 2025 17:34:19 +0000 (19:34 +0200)
Reported by Coverity.

* gettext-runtime/intl/loadmsgcat.c (_nl_load_domain): Free
sysdep_segment_values before 'goto invalid'.

gettext-runtime/intl/loadmsgcat.c

index 56fb38c04dc74a57c555f6b0ffcea08ec0e1fa74..1e2179cc8070f81c740da34e234831038c94f83f 100644 (file)
@@ -1,5 +1,5 @@
 /* Load needed message catalogs.
-   Copyright (C) 1995-2024 Free Software Foundation, Inc.
+   Copyright (C) 1995-2025 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -1018,7 +1018,10 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
                    /* Allocate additional memory.  */
                    mem = (char *) malloc (memneed);
                    if (mem == NULL)
-                     goto invalid;
+                     {
+                       free (sysdep_segment_values);
+                       goto invalid;
+                     }
 
                    domain->malloced = mem;
                    inmem_orig_sysdep_tab = (struct sysdep_string_desc *) mem;