X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fopenvpn.c;h=85760e996d27b8cd6a6cce3abb531631ad908ab1;hb=b4329683a35a886bb0cdd7ce843146eae0d6fd81;hp=f10b1746c18b3a7d39bb145dac8caa76aacd5846;hpb=c678b44c57256abd830b96742f18db5d49ccaf4c;p=collectd.git diff --git a/src/openvpn.c b/src/openvpn.c index f10b1746..85760e99 100644 --- a/src/openvpn.c +++ b/src/openvpn.c @@ -712,17 +712,19 @@ static int openvpn_config (const char *key, const char *value) temp->version = status_version; temp->name = status_name; - vpn_list = realloc (vpn_list, (vpn_num + 1) * sizeof (vpn_status_t *)); - if (vpn_list == NULL) + vpn_status_t **tmp_list = realloc (vpn_list, (vpn_num + 1) * sizeof (*vpn_list)); + if (tmp_list == NULL) { char errbuf[1024]; ERROR ("openvpn plugin: realloc failed: %s", sstrerror (errno, errbuf, sizeof (errbuf))); + sfree (vpn_list); sfree (temp->file); sfree (temp); return (1); } + vpn_list = tmp_list; vpn_list[vpn_num] = temp; vpn_num++;