[libglnx: 1/2] _GLNX_TEST_SCOPED_TEMP_DIR: Fix memory and fd leak
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libglnx: 1/2] _GLNX_TEST_SCOPED_TEMP_DIR: Fix memory and fd leak
- Date: Sun, 15 Mar 2020 18:24:01 +0000 (UTC)
commit a652ede20b6bc4726fbbce41ea4657fc83d8c6bb
Author: Simon McVittie <smcv collabora com>
Date: Mon Nov 11 19:29:12 2019 +0000
_GLNX_TEST_SCOPED_TEMP_DIR: Fix memory and fd leak
This doesn't really matter, since it only happens when our process is
about to exit anyway, but it makes it easier to use AddressSanitizer
and similar tools.
Signed-off-by: Simon McVittie <smcv collabora com>
tests/libglnx-testlib.c | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/tests/libglnx-testlib.c b/tests/libglnx-testlib.c
index 5687d80..869d144 100644
--- a/tests/libglnx-testlib.c
+++ b/tests/libglnx-testlib.c
@@ -23,6 +23,8 @@
#include <errno.h>
+#include <glib/gstdio.h>
+
#include "libglnx.h"
struct _GLnxTestAutoTempDir
@@ -63,4 +65,10 @@ _glnx_test_auto_temp_dir_leave (_GLnxTestAutoTempDir *dir)
glnx_tmpdir_delete (&dir->temp_dir, NULL, &error);
g_assert_no_error (error);
+
+ g_close (dir->old_cwd_fd, &error);
+ g_assert_no_error (error);
+
+ g_free (dir->old_cwd);
+ g_free (dir);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]