]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/loopdev: fix possible dir leak on error
authorKarel Zak <kzak@redhat.com>
Wed, 1 Feb 2012 12:06:34 +0000 (13:06 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 1 Feb 2012 12:06:34 +0000 (13:06 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/loopdev.c

index 9eb21025f7886fa93b272a61e4c8ed3900b02887..8ba3d1089804a08d68a00a57b616157b4a13a5ab 100644 (file)
@@ -427,6 +427,7 @@ static int loop_scandir(const char *dirname, int **ary, int hasprefix)
                        tmp = realloc(*ary, arylen * sizeof(int));
                        if (!tmp) {
                                free(*ary);
+                               closedir(dir);
                                return -1;
                        }
                        *ary = tmp;