40 lines
1.0 KiB
Diff
40 lines
1.0 KiB
Diff
From dae3abf2af80bf980792c32515e98704ed2ac3a6 Mon Sep 17 00:00:00 2001
|
|
From: Jannick <thirdedition@gmx.net>
|
|
Date: Thu, 1 Nov 2018 18:24:50 +0100
|
|
Subject: [PATCH 42/61] sed: fix memory leakage under lint
|
|
|
|
The NULL-initialized char string in_place_extension is free'ed everytime
|
|
it is redefined (using xstrdup) and at program exit with any return code.
|
|
|
|
See: https://lists.gnu.org/r/sed-devel/2018-11/msg00005.html
|
|
|
|
* sed/sed.c (main, cleanup): Free 'in_place_extension' if running with
|
|
lint.
|
|
---
|
|
sed/sed.c | 2 ++
|
|
1 file changed, 2 insertions(+)
|
|
|
|
diff --git a/sed/sed.c b/sed/sed.c
|
|
index 5ff49c0..e814613 100644
|
|
--- a/sed/sed.c
|
|
+++ b/sed/sed.c
|
|
@@ -91,6 +91,7 @@ struct localeinfo localeinfo;
|
|
static void
|
|
cleanup (void)
|
|
{
|
|
+ IF_LINT (free (in_place_extension));
|
|
if (G_file_to_unlink)
|
|
unlink (G_file_to_unlink);
|
|
}
|
|
@@ -307,6 +307,7 @@
|
|
|
|
case 'i':
|
|
separate_files = true;
|
|
+ IF_LINT (free (in_place_extension));
|
|
if (optarg == NULL)
|
|
/* use no backups */
|
|
in_place_extension = ck_strdup ("*");
|
|
--
|
|
2.19.1
|
|
|