ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
572a44
From 9765cfab7747c4d9435ec16a5fe29affeb2e52a7 Mon Sep 17 00:00:00 2001
572a44
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
572a44
Date: Sat, 12 Oct 2013 13:43:07 -0400
572a44
Subject: [PATCH] Make sure that we don't dereference NULL
572a44
572a44
The code was actually safe, because b should
572a44
never be null, because if rvalue is empty, a different
572a44
branch is taken. But we *do* check for NULL in the
572a44
loop above, so it's better to also check here for symmetry.
572a44
---
572a44
 src/core/load-fragment.c | 3 ++-
572a44
 1 file changed, 2 insertions(+), 1 deletion(-)
572a44
572a44
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
572a44
index 44920d6..f01843d 100644
572a44
--- a/src/core/load-fragment.c
572a44
+++ b/src/core/load-fragment.c
572a44
@@ -1860,7 +1860,8 @@ int config_parse_documentation(const char *unit,
572a44
                         free(*a);
572a44
                 }
572a44
         }
572a44
-        *b = NULL;
572a44
+        if (b)
572a44
+                *b = NULL;
572a44
 
572a44
         return r;
572a44
 }