]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fstab-generator: fix memleak
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 2 May 2015 17:01:28 +0000 (12:01 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 2 May 2015 17:01:28 +0000 (13:01 -0400)
filtered was used to store an allocated string twice. The first allocation was
thus lost. The string is not needed for anything, so simply skip the allocation.

Fixup for deb0a77cf0b409141c4.

src/fstab-generator/fstab-generator.c

index cb5112ec6d1d68183b13500fe7bd2b70c043eb2a..7aee3359e770de095b130348105a457e18eb8ead 100644 (file)
@@ -154,13 +154,13 @@ static bool mount_in_initrd(struct mntent *me) {
                streq(me->mnt_dir, "/usr");
 }
 
-static int write_idle_timeout(FILE *f, const char *where, const char *opts, char **filtered) {
+static int write_idle_timeout(FILE *f, const char *where, const char *opts) {
         _cleanup_free_ char *timeout = NULL;
         char timespan[FORMAT_TIMESPAN_MAX];
         usec_t u;
         int r;
 
-        r = fstab_filter_options(opts, "x-systemd.idle-timeout\0", NULL, &timeout, filtered);
+        r = fstab_filter_options(opts, "x-systemd.idle-timeout\0", NULL, &timeout, NULL);
         if (r < 0)
                 return log_warning_errno(r, "Failed to parse options: %m");
         if (r == 0)
@@ -315,7 +315,7 @@ static int add_mount(
                         "Where=%s\n",
                         where);
 
-                r = write_idle_timeout(f, where, opts, &filtered);
+                r = write_idle_timeout(f, where, opts);
                 if (r < 0)
                         return r;