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:
authorJunio C Hamano <gitster@pobox.com>2018-05-08 09:59:34 +0300
committerJunio C Hamano <gitster@pobox.com>2018-05-08 09:59:34 +0300
commit71c848bb28a2fcef918178f286f7e43d9804588d (patch)
tree3dce8d79ffa6e3cd81d9076afb59d9b3a878c93c /gettext.c
parenta56fb3dcc09239795823de40ffcbbf5713114eb5 (diff)
parent4d5b4c247597a5891beb84d933b8eecb77c76186 (diff)
Merge branch 'js/runtime-prefix'
* js/runtime-prefix: Avoid multiple PREFIX definitions git_setup_gettext: plug memory leak gettext: avoid initialization if the locale dir is not present
Diffstat (limited to 'gettext.c')
-rw-r--r--gettext.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gettext.c b/gettext.c
index baba28343c..7272771c8e 100644
--- a/gettext.c
+++ b/gettext.c
@@ -159,15 +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)) {
+ 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 */