File: lib-path-avoid-double-free-for-cpusets.patch

package info (click to toggle)
util-linux 2.41.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 92,992 kB
  • sloc: ansic: 179,068; sh: 22,693; yacc: 1,284; makefile: 530; xml: 422; python: 316; lex: 89; ruby: 75; csh: 37; exp: 19; sed: 16; perl: 15; sql: 9
file content (26 lines) | stat: -rw-r--r-- 620 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From: Karel Zak <kzak@redhat.com>
Date: Wed, 2 Jul 2025 12:25:45 +0200
Subject: lib/path: avoid double free() for cpusets

Addresses: https://github.com/util-linux/util-linux/issues/3641
Signed-off-by: Karel Zak <kzak@redhat.com>
---
 lib/path.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/path.c b/lib/path.c
index 48324d6..a828aea 100644
--- a/lib/path.c
+++ b/lib/path.c
@@ -1057,8 +1057,10 @@ static int ul_path_cpuparse(struct path_cxt *pc, cpu_set_t **set, int maxcpus, i
 	rc = 0;
 
 out:
-	if (rc)
+	if (rc) {
 		cpuset_free(*set);
+		*set = NULL;
+	}
 	free(buf);
 	return rc;
 }