libqmi/0008-qmicli-pdc-avoid-leaking-file_contents.patch
Lubomir Rintel ac8c0ebdf0 Add patches for a pair of bugs that make static analysis unhappy
Real bugs, but no security implications. Let's check the boxes and fix
them, to reduce the static analysis tooling noise.

Resolves: https://issues.redhat.com/browse/RHEL-38475
2024-06-25 10:39:47 +02:00

26 lines
862 B
Diff

From e7651c90e8d081371486deabd44db2b796a546f1 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Thu, 23 May 2024 10:45:34 +0200
Subject: [PATCH 8/9] qmicli-pdc: avoid leaking file_contents[]
Release it when not needed any more.
---
src/qmicli/qmicli-pdc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/qmicli/qmicli-pdc.c b/src/qmicli/qmicli-pdc.c
index 8139ef4b..4e7a19c4 100644
--- a/src/qmicli/qmicli-pdc.c
+++ b/src/qmicli/qmicli-pdc.c
@@ -1127,6 +1127,7 @@ load_config_file_from_string (const gchar *str)
hash_size = g_checksum_type_get_length (G_CHECKSUM_SHA1);
checksum = g_checksum_new (G_CHECKSUM_SHA1);
g_checksum_update (checksum, file_contents, file_size);
+ g_free (file_contents);
data = g_slice_new (LoadConfigFileData);
data->mapped_file = g_mapped_file_ref (mapped_file);
--
2.45.2