From: Bruno Haible Date: Mon, 28 Jul 2025 14:01:40 +0000 (+0200) Subject: Fix a small memory leak. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f9e3329954a4f7d3fc9dd6757226bd6d93a00e22;p=thirdparty%2Fgettext.git Fix a small memory leak. Reported by Coverity. * gettext-tools/src/format-python.c (format_parse): Free name before returning. --- diff --git a/gettext-tools/src/format-python.c b/gettext-tools/src/format-python.c index 78b315430..41ce96b3e 100644 --- a/gettext-tools/src/format-python.c +++ b/gettext-tools/src/format-python.c @@ -191,6 +191,7 @@ format_parse (const char *format, bool translated, char *fdi, /* Named and unnamed specifications are exclusive. */ if (spec.named_arg_count > 0) { + free (name); *invalid_reason = INVALID_MIXES_NAMED_UNNAMED (); FDI_SET (format - 1, FMTDIR_ERROR); goto bad_format; @@ -220,6 +221,7 @@ format_parse (const char *format, bool translated, char *fdi, /* Named and unnamed specifications are exclusive. */ if (spec.named_arg_count > 0) { + free (name); *invalid_reason = INVALID_MIXES_NAMED_UNNAMED (); FDI_SET (format - 1, FMTDIR_ERROR); goto bad_format; @@ -267,6 +269,7 @@ format_parse (const char *format, bool translated, char *fdi, type = FAT_FLOAT; break; default: + free (name); if (*format == '\0') { *invalid_reason = INVALID_UNTERMINATED_DIRECTIVE (); @@ -288,6 +291,7 @@ format_parse (const char *format, bool translated, char *fdi, /* Named and unnamed specifications are exclusive. */ if (spec.unnamed_arg_count > 0) { + free (name); *invalid_reason = INVALID_MIXES_NAMED_UNNAMED (); FDI_SET (format, FMTDIR_ERROR); goto bad_format; @@ -309,6 +313,7 @@ format_parse (const char *format, bool translated, char *fdi, /* Named and unnamed specifications are exclusive. */ if (spec.named_arg_count > 0) { + free (name); *invalid_reason = INVALID_MIXES_NAMED_UNNAMED (); FDI_SET (format, FMTDIR_ERROR); goto bad_format;