/* Load needed message catalogs.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
+ Copyright (C) 1995-2017 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
domain = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
if (domain == NULL)
- goto out;
+ {
+#ifdef HAVE_MMAP
+ if (use_mmap)
+ munmap ((caddr_t) data, size);
+ else
+#endif
+ free (data);
+ goto out;
+ }
domain_file->data = domain;
domain->data = (char *) data;
/* Handle aliases for locale names.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
+ Copyright (C) 1995-2017 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
# include "relocatable.h"
#else
# define relocate(pathname) (pathname)
+# define relocate2(pathname,allocatedp) (*(allocatedp) = NULL, (pathname))
#endif
/* @@ end of prolog @@ */
{
FILE *fp;
char *full_fname;
+ char *malloc_full_fname;
size_t added;
static const char aliasfile[] = "/locale.alias";
#ifdef _LIBC
/* Note the file is opened with cancellation in the I/O functions
disabled. */
- fp = fopen (relocate (full_fname), "rce");
+ fp = fopen (relocate2 (full_fname, &malloc_full_fname), "rce");
#else
- fp = fopen (relocate (full_fname), "r");
+ fp = fopen (relocate2 (full_fname, &malloc_full_fname), "r");
#endif
+ free (malloc_full_fname);
freea (full_fname);
if (fp == NULL)
return 0;