X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fglobset.c;h=5ffdfa20ac95d43725431265e23753089543db33;hb=862fb68b0a1e60449ac6d977727c7e2b4f069c99;hp=2bad449f90889de5d92091a1495eae08286b8368;hpb=043c27c3a8fd323d59e41288b6fd24f0e9bfa9a3;p=src%2Fapp-framework-binder.git diff --git a/src/globset.c b/src/globset.c index 2bad449f..5ffdfa20 100644 --- a/src/globset.c +++ b/src/globset.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018, 2019 "IoT.bzh" + * Copyright (C) 2015-2020 "IoT.bzh" * Author: José Bollo * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -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 * @@ -323,7 +318,7 @@ int globset_add( } /* not found, create it */ - ph = malloc(len + sizeof *ph); + ph = malloc(1 + len + sizeof *ph); if (!ph) return -1;