]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
losetup: fix mem leak, improve code [coverity scan]
authorKarel Zak <kzak@redhat.com>
Wed, 25 Jul 2018 09:56:44 +0000 (11:56 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 25 Jul 2018 09:56:44 +0000 (11:56 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/losetup.c

index 7525d8449fbda0b9263ec062d96b7ac4a1901a2b..7d14f566cf8c9f41ecaab0153fa19a305d018201 100644 (file)
@@ -141,8 +141,7 @@ static int printf_loopdev(struct loopdev_cxt *lc)
 
                if (loopcxt_get_sizelimit(lc, &x) == 0 && x)
                                printf(_(", sizelimit %ju"), x);
-               printf("\n");
-               return 0;
+               goto done;
        }
 
        printf("%s: [%04d]:%" PRIu64 " (%s)",
@@ -162,6 +161,9 @@ static int printf_loopdev(struct loopdev_cxt *lc)
                if (e && *e)
                        printf(_(", encryption %s (type %u)"), e, type);
        }
+
+done:
+       free(fname);
        printf("\n");
        return 0;
 }