From: Michael D. Lowis Date: Thu, 17 Jan 2019 01:57:06 +0000 (-0500) Subject: fixed null pointer access X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=e4b81748b199f6a388a50315aa0bf87cad6b5352;p=projs%2Ftide.git fixed null pointer access --- diff --git a/src/registrar.c b/src/registrar.c index d956382..1a37109 100644 --- a/src/registrar.c +++ b/src/registrar.c @@ -147,19 +147,19 @@ void propnotify(XConf* x, XEvent* e) { if(file) XFree(file); if(addr) XFree(addr); } -// /* cleanup any invalid windows */ -// TWindow* wins = Windows; -// Windows = NULL; -// while (wins) { -// TWindow* curr = wins; -// wins = curr->next; -// if (!wins->path) { -// free(curr); -// } else { -// curr->next = Windows; -// Windows = curr; -// } -// } + /* cleanup any invalid windows */ + TWindow* wins = Windows; + Windows = NULL; + while (wins && wins->next) { + TWindow* curr = wins; + wins = curr->next; + if (!wins->path) { + free(curr); + } else { + curr->next = Windows; + Windows = curr; + } + } } void find_windows(XConf* x) {