-/* Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.org>.
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <alloca.h>
#include <errno.h>
return (nl_catd) -1;
if (__open_catalog (cat_name, nlspath, env_var, result) != 0)
- /* Couldn't open the file. */
- return (nl_catd) -1;
+ {
+ /* Couldn't open the file. */
+ free ((void *) result);
+ return (nl_catd) -1;
+ }
return (nl_catd) result;
}
{
__nl_catd catalog;
+ /* Be generous if catalog which failed to be open is used. */
+ if (catalog_desc == (nl_catd) -1)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
catalog = (__nl_catd) catalog_desc;
#ifdef _POSIX_MAPPED_FILES