X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fopenvpn.c;h=65440d5cffa21f5f39db8766d3cbef6407a4e950;hb=99eb08be924850cf76e3dece205d5cbf9c7d74c7;hp=cf8c2123e9a249fb47481c88bd25d0139fdea167;hpb=30245d7b0ad267604d3675cfba66c2eda775e236;p=collectd.git diff --git a/src/openvpn.c b/src/openvpn.c index cf8c2123..65440d5c 100644 --- a/src/openvpn.c +++ b/src/openvpn.c @@ -617,6 +617,14 @@ static int openvpn_config (const char *key, const char *value) /* create a new vpn element since file, version and name are ok */ temp = (vpn_status_t *) malloc (sizeof (vpn_status_t)); + if (temp == NULL) + { + char errbuf[1024]; + ERROR ("openvpn plugin: malloc failed: %s", + sstrerror (errno, errbuf, sizeof (errbuf))); + sfree (status_file); + return (1); + } temp->file = status_file; temp->version = status_version; temp->name = status_name; @@ -625,7 +633,7 @@ static int openvpn_config (const char *key, const char *value) if (vpn_list == NULL) { char errbuf[1024]; - ERROR ("openvpn plugin: malloc failed: %s", + ERROR ("openvpn plugin: realloc failed: %s", sstrerror (errno, errbuf, sizeof (errbuf))); sfree (temp->file);