daandemeyer / rpms / systemd

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