diff --git a/src/openvpn.c b/src/openvpn.c
index f10b1746c18b3a7d39bb145dac8caa76aacd5846..85760e996d27b8cd6a6cce3abb531631ad908ab1 100644 (file)
--- a/src/openvpn.c
+++ b/src/openvpn.c
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++;