diff --git a/src/collectd-nagios.c b/src/collectd-nagios.c
index e31d95ca31f3e52ebd2923e0482b3e7f7973f294..7fda6fc120a3aa4c94eaa640092ab2ff39724f40 100644 (file)
--- a/src/collectd-nagios.c
+++ b/src/collectd-nagios.c
if ((hostname == NULL) || strcasecmp (hostname, ret_ident[i].host))
{
- if (hostname != NULL)
- free (hostname);
+ free (hostname);
hostname = strdup (ret_ident[i].host);
printf ("Host: %s\n", hostname);
}
printf ("ERROR: listval: Failed to convert returned "
"identifier to a string: %s\n",
lcc_strerror (connection));
+ free (hostname);
+ hostname = NULL;
continue;
}
printf ("\t%s\n", id + 1);
}
- if (ret_ident != NULL)
- free (ret_ident);
+ free (ret_ident);
+ free (hostname);
return (RET_OKAY);
} /* int do_listval */