Fix globset compilation warning 48/23648/3 8.99.5 icefish/8.99.5 icefish_8.99.5
authorJosé Bollo <jose.bollo@iot.bzh>
Thu, 23 Jan 2020 17:09:51 +0000 (18:09 +0100)
committerJosé Bollo <jose.bollo@iot.bzh>
Sun, 26 Jan 2020 22:20:29 +0000 (22:20 +0000)
The case of returning NULL is not tested in `globset_add`.
It is safe because `grow` is called first and then `search`
never returns a NULL pointer.

Bug-AGL: SPEC-3134

Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Change-Id: I21e8ba3a6c8202a920c6784f4d61376450b9a063

src/globset.c

index 124ff24..5ffdfa2 100644 (file)
@@ -227,21 +227,16 @@ static struct pathndl *search(
                pph = &set->globs;
        else if (set->exacts)
                pph = &set->exacts[hash & set->gmask];
-       else
+       else {
+               *pprev = NULL;
                return NULL;
+       }
        while ((ph = *pph) && strcmp(normal, ph->handler.pattern))
                pph = &ph->next;
        *pprev = pph;
        return ph;
 }
 
-
-
-
-
-
-
-
 /**
  * Allocates a new set of handlers
  *