Created
December 11, 2012 13:57
-
-
Save kyprizel/4258758 to your computer and use it in GitHub Desktop.
Leak fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 22e62551e81082d83e04ac7d18262f283b2d695e Mon Sep 17 00:00:00 2001 | |
From: Eldar Zaitov <eldar@kyprizel.net> | |
Date: Tue, 11 Dec 2012 17:52:09 +0400 | |
Subject: [PATCH] fixed fd leak in logger | |
--- | |
engine/core.c | 11 +++++++++++ | |
1 file changed, 11 insertions(+) | |
diff --git a/engine/core.c b/engine/core.c | |
index bbc0c22..5bca9ef 100644 | |
--- a/engine/core.c | |
+++ b/engine/core.c | |
@@ -673,6 +673,17 @@ static void logger_api_vlogmsg(ib_provider_inst_t *lpi, | |
*/ | |
iface->logger(lpi_data->fp, level, ib, file, line, which_fmt, ap); | |
+ if (lpi_data->fp != NULL) { | |
+ if (fclose(lpi_data->fp) < 0) { | |
+ fprintf(stderr, | |
+ "logger_api_vlogmsg:Failed closing our fp %p: %s\n", | |
+ (void *)lpi_data->fp, strerror(errno)); | |
+ | |
+ } | |
+ lpi_data->fp = NULL; | |
+ lpi_data->log_uri = NULL; | |
+ } | |
+ | |
done: | |
if (new_fmt) { | |
free(new_fmt); | |
-- | |
1.7.10.4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment