]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
Fix seg fault in format_name
authorBarbara Kaczorowska <bkjg@google.com>
Mon, 21 Sep 2020 10:21:27 +0000 (10:21 +0000)
committerBarbara Kaczorowska <bkjg@google.com>
Mon, 21 Sep 2020 10:21:27 +0000 (10:21 +0000)
src/utils/common/common.c

index 89fe6f52bac7ada4e6ff324a16fdf97f985c7787..cba23fdb5813be1068454c8c868d99bc39b6bd48 100644 (file)
@@ -884,7 +884,9 @@ int format_name(char *ret, int ret_len, const char *hostname,
   assert(plugin != NULL);
   assert(type != NULL);
 
-  APPEND(hostname);
+  if (hostname != NULL)
+    APPEND(hostname);
+
   APPEND("/");
   APPEND(plugin);
   if ((plugin_instance != NULL) && (plugin_instance[0] != 0)) {