[BUG] config: don't crash on empty pattern files.
Both Hank A. Paulson and Rob at pixsense reported a crash when
loading ACLs from a pattern file which contains empty lines.
From the tests, it appears that only files that contain nothing
but empty lines are causing that (in the past they would have had
their line feeds loaded as patterns).
The crash happens in the free_pattern() call which doesn't like to
be called with a NULL pattern. Let's make it accept it so that it's
more in line with the standard uses of free() which ignores NULLs.
diff --git a/src/acl.c b/src/acl.c
index fcfbf9f..26b82cb 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -1008,8 +1008,11 @@
return NULL;
}
+/* NB: does nothing if <pat> is NULL */
static void free_pattern(struct acl_pattern *pat)
{
+ if (!pat)
+ return;
if (pat->ptr.ptr) {
if (pat->freeptrbuf)