summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: afe1ccb)
raw | patch | inline | side by side (parent: afe1ccb)
author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Sat, 23 Apr 2016 09:35:26 +0000 (11:35 +0200) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Sat, 23 Apr 2016 09:35:26 +0000 (11:35 +0200) |
[src/openvpn.c:715]: (error) Common realloc mistake: 'vpn_list' nulled but not freed upon failure
src/openvpn.c | patch | blob | history |
diff --git a/src/openvpn.c b/src/openvpn.c
index 9490ac8b6086a2c68efbadca4814b0a688b64f9c..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_list));
- 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++;