From 3fe9d9d611fdecf9872dee20b73b7658b048dd01 Mon Sep 17 00:00:00 2001 From: liyunqing Date: Wed, 27 Nov 2024 16:53:50 +0800 Subject: [PATCH] fix memory leak --- ...me_device-free-path-after-it-is-used.patch | 33 +++++++++++++++++++ initscripts.spec | 9 ++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 backport-rename_device-free-path-after-it-is-used.patch diff --git a/backport-rename_device-free-path-after-it-is-used.patch b/backport-rename_device-free-path-after-it-is-used.patch new file mode 100644 index 0000000..c8f1c36 --- /dev/null +++ b/backport-rename_device-free-path-after-it-is-used.patch @@ -0,0 +1,33 @@ +From 2b185d6bb1eda7e5bdd885afc88bf404d2c1f861 Mon Sep 17 00:00:00 2001 +From: Lukas Nykryn +Date: Fri, 1 Mar 2024 14:36:45 +0100 +Subject: [PATCH] rename_device: free path after it is used + +--- + src/rename_device.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/rename_device.c b/src/rename_device.c +index 0d29f64d..e6b09f45 100644 +--- a/src/rename_device.c ++++ b/src/rename_device.c +@@ -180,7 +180,7 @@ struct netdev *get_configs() { + return ret; + } + for (x = 0; x < ncfgs; x++ ) { +- char *path; ++ char *path = NULL; + char *devname, *hwaddr; + int vlan; + gchar *contents, **lines; +@@ -193,6 +193,7 @@ struct netdev *get_configs() { + cfgs[x]->d_name) == -1) + continue; + g_file_get_contents(path, &contents, NULL, NULL); ++ free(path); + if (!contents) + continue; + lines = g_strsplit(contents,"\n", 0); +-- +2.43.0 + diff --git a/initscripts.spec b/initscripts.spec index 93ef1bd..7c37f70 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -20,7 +20,7 @@ Requires: gawk \ Name: initscripts Summary: Basic support for legacy System V init scripts Version: 10.17 -Release: 2 +Release: 3 License: GPLv2 @@ -92,6 +92,7 @@ Patch9004: bugfix-restart-network-warning.patch Patch9005: new-network-fork-to-start-dhcp.patch Patch9006: exec-udevadm-settle-when-network-start.patch Patch9007: remove-rename_device_lock-when-process-does-not-exis.patch +Patch9008: backport-rename_device-free-path-after-it-is-used.patch %description This package provides basic support for legacy System V init scripts, and some @@ -387,6 +388,12 @@ fi # ============================================================================= %changelog +* Wed Nov 27 2024 liyunqing - 10.17-3 +- Type: bugfix +- ID: NA +- SUG: NA +- DESC: backport to fix memory leak + * Mon Feb 20 2023 gaihuiying - 10.17-2 - Type:bugfix - ID:NA -- Gitee