valeriyvdovin / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

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

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