From 6fa3d8eca2cea1adc024189f35ae76481a190f40 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 3 Aug 2025 19:34:19 +0200 Subject: [PATCH] intl: Fix a small memory leak. Reported by Coverity. * gettext-runtime/intl/loadmsgcat.c (_nl_load_domain): Free sysdep_segment_values before 'goto invalid'. --- gettext-runtime/intl/loadmsgcat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gettext-runtime/intl/loadmsgcat.c b/gettext-runtime/intl/loadmsgcat.c index 56fb38c04..1e2179cc8 100644 --- a/gettext-runtime/intl/loadmsgcat.c +++ b/gettext-runtime/intl/loadmsgcat.c @@ -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; -- 2.47.3