From d4288570b9513c706907deb882ec6a15e218d0e3 Mon Sep 17 00:00:00 2001 From: Lyndon Nerenberg Date: Thu, 10 Apr 2014 03:07:16 -0700 Subject: [PATCH] Clang's static analyzer reports a potential NULL pointer deref. This is a "shouldn't happen" case, so I have added an assert to quell the warning, and catch the failure in the off chance we do get here with last == NULL. --- uip/new.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/uip/new.c b/uip/new.c index 8d235b17..83b09664 100644 --- a/uip/new.c +++ b/uip/new.c @@ -406,8 +406,11 @@ doit(char *cur, char *folders, char *sequences[]) /* If we're fnext, we haven't checked the last node yet. If it's the * current folder, return the first node. */ - if (run_mode == FNEXT && strcmp(last->n_name, cur) == 0) { - return first; + if (run_mode == FNEXT) { + assert(last != NULL); + if (strcmp(last->n_name, cur) == 0) { + return first; + } } if (run_mode == NEW) { -- 2.56.0