]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
blkid: Fix memory leaks
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 11 Apr 2026 18:48:08 +0000 (20:48 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 12 Apr 2026 11:08:38 +0000 (13:08 +0200)
If -L and -U arguments are supplied, optarg string duplication leaks
memory.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
misc-utils/blkid.c

index 29f2046f70a8a4b6c2448330f31d66393beabff4..c14c9897e2871825f1abf94d3bc8036e5855f278 100644 (file)
@@ -755,7 +755,9 @@ int main(int argc, char **argv)
                        break;
                case 'L':
                        ctl.eval = 1;
+                       free(search_value);
                        search_value = xstrdup(optarg);
+                       free(search_type);
                        search_type = xstrdup("LABEL");
                        break;
                case 'n':
@@ -766,7 +768,9 @@ int main(int argc, char **argv)
                        break;
                case 'U':
                        ctl.eval = 1;
+                       free(search_value);
                        search_value = xstrdup(optarg);
+                       free(search_type);
                        search_type = xstrdup("UUID");
                        break;
                case 'i':