udisks2/udisks-2.10.0-g_mkdtemp-lea...

33 lines
1.2 KiB
Diff

From fcdec5d58ba2bbe6d7ecf7168ab1a11282763041 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Fri, 16 Apr 2021 18:15:03 +0200
Subject: [PATCH 5/8] udiskslinuxfilesystemhelpers: Fix leaking string in case
g_mkdtemp() fails
---
src/udiskslinuxfilesystemhelpers.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/udiskslinuxfilesystemhelpers.c b/src/udiskslinuxfilesystemhelpers.c
index 74d83152..7c5fc037 100644
--- a/src/udiskslinuxfilesystemhelpers.c
+++ b/src/udiskslinuxfilesystemhelpers.c
@@ -142,11 +142,11 @@ take_filesystem_ownership (const gchar *device,
else
{
/* device is not mounted, we need to mount it */
- mountpoint = g_mkdtemp (g_strdup ("/run/udisks2/temp-mount-XXXXXX"));
- if (mountpoint == NULL)
+ mountpoint = g_strdup ("/run/udisks2/temp-mount-XXXXXX");
+ if (g_mkdtemp (mountpoint) == NULL)
{
g_set_error (error, UDISKS_ERROR, UDISKS_ERROR_FAILED,
- "Cannot create temporary mountpoint.");
+ "Cannot create temporary mountpoint: %m.");
success = FALSE;
goto out;
}
--
2.30.2