Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2018-04-21 14:14:28 +0300
committerJunio C Hamano <gitster@pobox.com>2018-04-24 05:12:32 +0300
commit0210231b0803f881bf765bb2d7284c119c6ce9b6 (patch)
tree27ab762dcb97879f01db6cad5964af5b83b72871 /gettext.c
parentcc5e1bf992470e0d514c743e75a0325c8b592f38 (diff)
git_setup_gettext: plug memory leak
The system_path() function returns a freshly-allocated string. We need to release it. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gettext.c')
-rw-r--r--gettext.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gettext.c b/gettext.c
index 3eb20c5f95..4f59dfa3d1 100644
--- a/gettext.c
+++ b/gettext.c
@@ -159,18 +159,23 @@ static void init_gettext_charset(const char *domain)
void git_setup_gettext(void)
{
const char *podir = getenv(GIT_TEXT_DOMAIN_DIR_ENVIRONMENT);
+ char *p = NULL;
if (!podir)
- podir = system_path(GIT_LOCALE_PATH);
+ podir = p = system_path(GIT_LOCALE_PATH);
- if (!is_directory(podir))
+ if (!is_directory(podir)) {
+ free(p);
return;
+ }
bindtextdomain("git", podir);
setlocale(LC_MESSAGES, "");
setlocale(LC_TIME, "");
init_gettext_charset("git");
textdomain("git");
+
+ free(p);
}
/* return the number of columns of string 's' in current locale */