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