From fc0ffc8b991de10acc7cf6c982f695c91b36e928 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 19 May 2017 01:37:15 +0200 Subject: [PATCH] Fix missing unlock. Found by Coverity. * gettext-runtime/intl/dcigettext.c (_nl_find_msg): Unlock the lock and free allocated memory before returning. --- gettext-runtime/intl/dcigettext.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gettext-runtime/intl/dcigettext.c b/gettext-runtime/intl/dcigettext.c index 92f6fd685..e81fdafd2 100644 --- a/gettext-runtime/intl/dcigettext.c +++ b/gettext-runtime/intl/dcigettext.c @@ -1,5 +1,5 @@ /* Implementation of the internal dcigettext function. - 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 @@ -1111,7 +1111,12 @@ _nl_find_msg (struct loaded_l10nfile *domain_file, /* Resource problems are fatal. If we continue onwards we will only attempt to calloc a new conv_tab and fail later. */ if (__builtin_expect (nullentry == (char *) -1, 0)) - return (char *) -1; + { +# ifndef IN_LIBGLOCALE + free ((char *) encoding); +# endif + goto unlock_fail; + } if (nullentry != NULL) { -- 2.47.3