Ticket #2041: check return value of g_strdup_printf() in mc_log().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Vit Rosin 2010-03-31 14:24:38 +04:00 committed by Andrew Borodin
parent 7ada01bfa1
commit 2eb870c9c9

View File

@ -67,12 +67,14 @@ mc_log(const char *fmt, ...)
if (is_logging_enabled()) { if (is_logging_enabled()) {
va_start(args, fmt); va_start(args, fmt);
logfilename = g_strdup_printf("%s/%s/log", home_dir, MC_USERCONF_DIR); logfilename = g_strdup_printf("%s/%s/log", home_dir, MC_USERCONF_DIR);
f = fopen (logfilename, "a"); if (logfilename != NULL) {
if (f != NULL) { f = fopen (logfilename, "a");
if (f != NULL) {
(void)vfprintf(f, fmt, args); (void)vfprintf(f, fmt, args);
(void)fclose(f); (void)fclose(f);
}
g_free(logfilename);
va_end(args);
} }
g_free(logfilename);
va_end(args);
} }
} }