chiark / gitweb /
Make sure that we don't dereference NULL
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 12 Oct 2013 17:43:07 +0000 (13:43 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 13 Oct 2013 21:56:55 +0000 (17:56 -0400)
The code was actually safe, because b should
never be null, because if rvalue is empty, a different
branch is taken. But we *do* check for NULL in the
loop above, so it's better to also check here for symmetry.

src/core/load-fragment.c

index 44920d6..f01843d 100644 (file)
@@ -1860,7 +1860,8 @@ int config_parse_documentation(const char *unit,
                         free(*a);
                 }
         }
-        *b = NULL;
+        if (b)
+                *b = NULL;
 
         return r;
 }