]> www.infradead.org Git - mtd-utils.git/commitdiff
ubiupdatevol: Prevent null pointer dereference
authorBastian Germann <bastiangermann@fishpost.de>
Sun, 8 Sep 2019 19:59:22 +0000 (21:59 +0200)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Tue, 10 Sep 2019 08:16:51 +0000 (10:16 +0200)
libubi_close(libubi) is called in the error handler if libubi is null.
Prevent that by handling the error case similar to the other ubi
executables.

Signed-off-by: Bastian Germann <bastiangermann@fishpost.de>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
ubi-utils/ubiupdatevol.c

index bdcc09180bd775283f5737e004cdbdb3882fa667..1b3239ef4affb38294922583b1252f9aa232ad53 100644 (file)
@@ -308,9 +308,7 @@ int main(int argc, char * const argv[])
        if (!libubi) {
                if (errno == 0)
                        errmsg("UBI is not present in the system");
-               else
-                       sys_errmsg("cannot open libubi");
-               goto out_libubi;
+               return sys_errmsg("cannot open libubi");
        }
 
        err = ubi_probe_node(libubi, args.node);