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 44920d6449c862d90d7e5e0134032dcb4406fe00..f01843d65e77e28acbb984092ef6ec286f81f292 100644 (file)
@@ -1860,7 +1860,8 @@ int config_parse_documentation(const char *unit,
                         free(*a);
                 }
         }
                         free(*a);
                 }
         }
-        *b = NULL;
+        if (b)
+                *b = NULL;
 
         return r;
 }
 
         return r;
 }