]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: fix memleak
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 3 Sep 2025 21:52:01 +0000 (06:52 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 7 Oct 2025 09:48:58 +0000 (11:48 +0200)
Fixes a bug in 1a0541d44c78ced78a566051ec8f63417370aeaa (v256).

(cherry picked from commit 975f27a2b51db19992324346edbb4d264b495c03)

src/repart/repart.c

index 2942b5d966ae6196a2bc56824e2aa7735a64630c..938f0dca83ba9a3f5827105c92be65a7a711e10c 100644 (file)
@@ -7356,7 +7356,7 @@ static int context_fstab(Context *context) {
         fprintf(f, "# Automatically generated by systemd-repart\n\n");
 
         LIST_FOREACH(partitions, p, context->partitions) {
-                _cleanup_free_ char *what = NULL, *options = NULL;
+                _cleanup_free_ char *what = NULL;
 
                 if (!need_fstab_one(p))
                         continue;
@@ -7366,6 +7366,8 @@ static int context_fstab(Context *context) {
                         return r;
 
                 FOREACH_ARRAY(mountpoint, p->mountpoints, p->n_mountpoints) {
+                        _cleanup_free_ char *options = NULL;
+
                         r = partition_pick_mount_options(
                                         p->type.designator,
                                         p->format,