!32 [sync] PR-31: btrfs-progs: string-table: fix memory leak on exit path in table_vprintf()
From: @openeuler-sync-bot Reviewed-by: @swf504 Signed-off-by: @swf504
This commit is contained in:
commit
c25b89279c
35
0003-fix-memory-leak-on-exit-path-in-table-vprintf.patch
Normal file
35
0003-fix-memory-leak-on-exit-path-in-table-vprintf.patch
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
From 9c156ab9ca53e5fc15730a10d1773da04ea59d4d Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Sterba <dsterba@suse.com>
|
||||||
|
Date: Wed, 3 Apr 2024 23:13:54 +0200
|
||||||
|
Subject: [PATCH] btrfs-progs: string-table: fix memory leak on exit path in
|
||||||
|
table_vprintf()
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Reported by 'gcc -fanalyzer:
|
||||||
|
common/string-table.c:62:17: warning: leak of ‘msg’ [CWE-401] [-Wanalyzer-malloc-leak]
|
||||||
|
|
||||||
|
The 'msg' still allocated when returning from the function due to error,
|
||||||
|
free it.
|
||||||
|
|
||||||
|
Signed-off-by: David Sterba <dsterba@suse.com>
|
||||||
|
---
|
||||||
|
common/string-table.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/common/string-table.c b/common/string-table.c
|
||||||
|
index 298066c..6d941fa 100644
|
||||||
|
--- a/common/string-table.c
|
||||||
|
+++ b/common/string-table.c
|
||||||
|
@@ -57,6 +57,7 @@ char *table_vprintf(struct string_table *tab, unsigned int column, unsigned int
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (column >= tab->ncols || row >= tab->nrows) {
|
||||||
|
+ free(msg);
|
||||||
|
error("attempt to write outside of table: col %u row %u fmt %s",
|
||||||
|
column, row, fmt);
|
||||||
|
return NULL;
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: btrfs-progs
|
Name: btrfs-progs
|
||||||
Version: 6.6.3
|
Version: 6.6.3
|
||||||
Release: 3
|
Release: 4
|
||||||
Summary: btrfs userspace programs
|
Summary: btrfs userspace programs
|
||||||
License: GPLv2 and GPL+ and LGPL-2.1+ and GPL-3.0+ and LGPL-2.1 and MIT
|
License: GPLv2 and GPL+ and LGPL-2.1+ and GPL-3.0+ and LGPL-2.1 and MIT
|
||||||
URL: https://btrfs.wiki.kernel.org/index.php/Main_Page
|
URL: https://btrfs.wiki.kernel.org/index.php/Main_Page
|
||||||
@ -8,6 +8,7 @@ Source0: https://www.kernel.org/pub/linux/kernel/people/kdave/%{name}/%{name}
|
|||||||
|
|
||||||
Patch0001: 0001-fix-exclusive-op-enqueue-timeout.patch
|
Patch0001: 0001-fix-exclusive-op-enqueue-timeout.patch
|
||||||
Patch0002: 0002-subvolume-fix-return-value-when-the-target-exists.patch
|
Patch0002: 0002-subvolume-fix-return-value-when-the-target-exists.patch
|
||||||
|
Patch0003: 0003-fix-memory-leak-on-exit-path-in-table-vprintf.patch
|
||||||
|
|
||||||
BuildRequires: python3-devel >= 3.4
|
BuildRequires: python3-devel >= 3.4
|
||||||
BuildRequires: libacl-devel, e2fsprogs-devel, libblkid-devel, libuuid-devel, zlib-devel, libzstd-devel, lzo-devel, systemd-devel
|
BuildRequires: libacl-devel, e2fsprogs-devel, libblkid-devel, libuuid-devel, zlib-devel, libzstd-devel, lzo-devel, systemd-devel
|
||||||
@ -73,6 +74,9 @@ make mandir=%{_mandir} bindir=%{_sbindir} libdir=%{_libdir} incdir=%{_includedir
|
|||||||
%{_mandir}/man8/*.gz
|
%{_mandir}/man8/*.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed May 22 2024 Deyuan Fan <fandeyuan@kylinos.cn> - 6.6.3-4
|
||||||
|
- btrfs-progs: string-table: fix memory leak on exit path in table_vprintf()
|
||||||
|
|
||||||
* Wed May 8 2024 Deyuan Fan <fandeyuan@kylinos.cn> - 6.6.3-3
|
* Wed May 8 2024 Deyuan Fan <fandeyuan@kylinos.cn> - 6.6.3-3
|
||||||
- btrfs-progs: subvolume: fix return value when the target exists
|
- btrfs-progs: subvolume: fix return value when the target exists
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user