From: Jonathan Rajotte Date: Tue, 18 Oct 2016 22:09:53 +0000 (-0400) Subject: Fix: save: leak of configuration file fd X-Git-Tag: v2.8.3~12 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4a3a81ecdf4bf70a04c4b683222df9b6e655739f;p=lttng-tools.git Fix: save: leak of configuration file fd Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/save.c b/src/bin/lttng-sessiond/save.c index 9ac7712cb..1a879b214 100644 --- a/src/bin/lttng-sessiond/save.c +++ b/src/bin/lttng-sessiond/save.c @@ -2053,6 +2053,13 @@ end: } } + if (file_opened) { + ret = close(fd); + if (ret) { + PERROR("Closing XML session configuration"); + } + } + return ret; } diff --git a/src/common/config/session-config.h b/src/common/config/session-config.h index 939cb6cbf..d77d174c8 100644 --- a/src/common/config/session-config.h +++ b/src/common/config/session-config.h @@ -78,8 +78,8 @@ int config_parse_value(const char *value); /* * Create an instance of a configuration writer. * - * fd_output File to which the XML content must be written. The file will be - * closed once the config_writer has been destroyed. + * fd_output File to which the XML content must be written. fd_output is + * owned by the caller. * * indent If other than 0 the XML will be pretty printed * with indentation and newline.