From: Joel Stanley Date: Tue, 6 Mar 2018 04:02:20 +0000 (+1030) Subject: discover: pxe: Avoid dereferencing null pointer X-Git-Tag: v1.7.1~1 X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=commitdiff_plain;h=47d0601affe80d7f98a2053749f5e1d479f902f4;hp=2c97f136757b5428bb68f91cfa723990dcd985c8 discover: pxe: Avoid dereferencing null pointer When result is null, we may end up in the error handling path where we try to dereference null to call cleanup_local. This adds a check for result. Found with scan-build. Signed-off-by: Joel Stanley Reviewed-by: Cyril Bur Signed-off-by: Samuel Mendoza-Jonas [Fixed up commit message typo] --- diff --git a/discover/pxe-parser.c b/discover/pxe-parser.c index 5c80b13..d2ebaab 100644 --- a/discover/pxe-parser.c +++ b/discover/pxe-parser.c @@ -324,7 +324,7 @@ static void pxe_conf_parse_cb(struct load_url_result *result, void *data) talloc_free(buf); out_clean: - if (result->cleanup_local) + if (result && result->cleanup_local) unlink(result->local); talloc_free(conf); }