colord/colord-CVE-2021-42523.patch

48 lines
1.3 KiB
Diff

From 1452a975ecae14299fb27d41522dfd32305481ce Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
Date: Wed, 13 Apr 2022 14:21:32 +0100
Subject: [PATCH] trivial: Fix a small memory leak on db open failure
---
src/cd-mapping-db.c | 3 +--
src/cd-profile-db.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/cd-mapping-db.c b/src/cd-mapping-db.c
index 7a3df35..996f07e 100644
--- a/src/cd-mapping-db.c
+++ b/src/cd-mapping-db.c
@@ -67,7 +67,7 @@ cd_mapping_db_open (CdMappingDb *mdb,
GError **error)
{
CdMappingDbPrivate *priv = GET_PRIVATE (mdb);
- gchar *error_msg = NULL;
+ g_autofree gchar *error_msg = NULL;
gint rc;
g_autofree gchar *path = NULL;
@@ -116,7 +116,6 @@ cd_mapping_db_open (CdMappingDb *mdb,
CD_CLIENT_ERROR_INTERNAL,
"Cannot open mapping database: %s",
error_msg);
- sqlite3_free (error_msg);
return FALSE;
}
}
diff --git a/src/cd-profile-db.c b/src/cd-profile-db.c
index 5661d09..57ab864 100644
--- a/src/cd-profile-db.c
+++ b/src/cd-profile-db.c
@@ -48,7 +48,7 @@ cd_profile_db_load (CdProfileDb *pdb,
{
CdProfileDbPrivate *priv = GET_PRIVATE (pdb);
const gchar *statement;
- gchar *error_msg = NULL;
+ g_autofree gchar *error_msg = NULL;
gint rc;
g_autofree gchar *path = NULL;
--
2.37.3