chiark / gitweb /
conffile: find_cl_if: fix fail_if_invalid==False
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Oct 2019 22:34:33 +0000 (23:34 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 30 Dec 2019 13:15:49 +0000 (13:15 +0000)
If the key was not found, this would segfault, so passing False didn't
work properly.  Currently nothing does, so this bug is latent.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
conffile.c

index c03c1d8..e6cf48f 100644 (file)
@@ -661,6 +661,7 @@ void *find_cl_if(dict_t *dict, cstring_t name, uint32_t type,
     closure_t *cl;
 
     i = dict_find_item(dict,name,fail_if_invalid,desc,loc);
+    if (!i) return NULL;
     if (i->type!=t_closure) {
        if (!fail_if_invalid) return NULL;
        cfgfatal(loc,desc,"\"%s\" must be a closure\n",name);