]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
msgpre: Avoid a crash in an out-of-memory situation.
authorBruno Haible <bruno@clisp.org>
Fri, 1 May 2026 07:41:52 +0000 (09:41 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 1 May 2026 07:41:52 +0000 (09:41 +0200)
* gettext-tools/src/msgpre.c (main): Use xmalloc instead of malloc.

gettext-tools/src/msgpre.c

index 799f60e737f10031b579452207f8d8cdc6989484..283ddb125d80c667e5bfbe07d6731a66b06414a4 100644 (file)
@@ -368,7 +368,7 @@ There is NO WARRANTY, to the extent permitted by law.\n\
                   size_t len = strcspn (language, " \t\n");
                   if (len > 0)
                     {
-                      char *memory = (char *) malloc (len + 1);
+                      char *memory = (char *) xmalloc (len + 1);
                       memcpy (memory, language, len);
                       memory[len] = '\0';