From: Bastian Germann Date: Sun, 8 Sep 2019 19:59:22 +0000 (+0200) Subject: ubiupdatevol: Prevent null pointer dereference X-Git-Tag: v2.1.2~36 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3fd38416e7a4817d18173cdebd5b4c5d62c06220;p=mtd-utils.git ubiupdatevol: Prevent null pointer dereference 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 Signed-off-by: David Oberhollenzer --- diff --git a/ubi-utils/ubiupdatevol.c b/ubi-utils/ubiupdatevol.c index bdcc091..1b3239e 100644 --- a/ubi-utils/ubiupdatevol.c +++ b/ubi-utils/ubiupdatevol.c @@ -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);