From cc4e4d9bad2805750eed69a4f41f1ae0a1ea7e84 Mon Sep 17 00:00:00 2001 From: dwarning Date: Wed, 31 Oct 2018 08:55:30 +0100 Subject: [PATCH] verify pointer before utilization --- src/frontend/inp.c | 6 ++++-- src/frontend/plotting/x11.c | 3 ++- src/frontend/runcoms.c | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 83e83f094..813edea46 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -815,8 +815,10 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) /* now load deck into ft_curckt -- the current circuit. */ inp_dodeck(deck, tt, wl_first, FALSE, options, filename); - ft_curckt->devtlist = devtlist; - ft_curckt->modtlist = modtlist; + if (ft_curckt) { + ft_curckt->devtlist = devtlist; + ft_curckt->modtlist = modtlist; + } /* inp_dodeck did take ownership */ tt = NULL; diff --git a/src/frontend/plotting/x11.c b/src/frontend/plotting/x11.c index 5f6720cb7..65687b54d 100644 --- a/src/frontend/plotting/x11.c +++ b/src/frontend/plotting/x11.c @@ -1058,7 +1058,8 @@ X11_Input(REQUEST *request, RESPONSE *response) default: internalerror("unrecognized input type"); - response->option = error_option; + if (response) + response->option = error_option; return 1; break; } diff --git a/src/frontend/runcoms.c b/src/frontend/runcoms.c index 1e7bdc67d..17c28e032 100644 --- a/src/frontend/runcoms.c +++ b/src/frontend/runcoms.c @@ -342,7 +342,8 @@ dosim( if (rawfileFp) { if (ftell(rawfileFp) == 0) { (void) fclose(rawfileFp); - (void) unlink(wl->wl_word); + if (wl) + (void) unlink(wl->wl_word); } else { (void) fclose(rawfileFp); }