valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0453-fstab-generator-fix-memleak.patch

a19bc6
From c6b00287b8847c550ab75947f52e37282632a2f3 Mon Sep 17 00:00:00 2001
a19bc6
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
a19bc6
Date: Sat, 2 May 2015 12:01:28 -0500
a19bc6
Subject: [PATCH] fstab-generator: fix memleak
a19bc6
a19bc6
filtered was used to store an allocated string twice. The first allocation was
a19bc6
thus lost. The string is not needed for anything, so simply skip the allocation.
a19bc6
a19bc6
Fixup for deb0a77cf0b409141c4.
a19bc6
a19bc6
(cherry picked from commit 336b5c615e9c101476784b32df1b86aaeac96431)
a19bc6
Related: #1354410
a19bc6
---
a19bc6
 src/fstab-generator/fstab-generator.c | 6 +++---
a19bc6
 1 file changed, 3 insertions(+), 3 deletions(-)
a19bc6
a19bc6
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
181b3f
index a943393b0..32aca2244 100644
a19bc6
--- a/src/fstab-generator/fstab-generator.c
a19bc6
+++ b/src/fstab-generator/fstab-generator.c
a19bc6
@@ -214,13 +214,13 @@ static int write_requires_mounts_for(FILE *f, const char *opts) {
a19bc6
         return 0;
a19bc6
 }
a19bc6
 
a19bc6
-static int write_idle_timeout(FILE *f, const char *where, const char *opts, char **filtered) {
a19bc6
+static int write_idle_timeout(FILE *f, const char *where, const char *opts) {
a19bc6
         _cleanup_free_ char *timeout = NULL;
a19bc6
         char timespan[FORMAT_TIMESPAN_MAX];
a19bc6
         usec_t u;
a19bc6
         int r;
a19bc6
 
a19bc6
-        r = fstab_filter_options(opts, "x-systemd.idle-timeout\0", NULL, &timeout, filtered);
a19bc6
+        r = fstab_filter_options(opts, "x-systemd.idle-timeout\0", NULL, &timeout, NULL);
a19bc6
         if (r < 0)
a19bc6
                 return log_warning_errno(r, "Failed to parse options: %m");
a19bc6
         if (r == 0)
a19bc6
@@ -398,7 +398,7 @@ static int add_mount(
a19bc6
                         "Where=%s\n",
a19bc6
                         where);
a19bc6
 
a19bc6
-                r = write_idle_timeout(f, where, opts, &filtered);
a19bc6
+                r = write_idle_timeout(f, where, opts);
a19bc6
                 if (r < 0)
a19bc6
                         return r;
a19bc6