projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1710 from rpv-tomsk/perl-plugin-fixes
[collectd.git]
/
src
/
openvpn.c
diff --git
a/src/openvpn.c
b/src/openvpn.c
index
8bccce3
..
85760e9
100644
(file)
--- a/
src/openvpn.c
+++ b/
src/openvpn.c
@@
-699,7
+699,7
@@
static int openvpn_config (const char *key, const char *value)
}
/* create a new vpn element since file, version and name are ok */
}
/* create a new vpn element since file, version and name are ok */
- temp =
(vpn_status_t *) malloc (sizeof (vpn_status_t
));
+ temp =
malloc (sizeof (*temp
));
if (temp == NULL)
{
char errbuf[1024];
if (temp == NULL)
{
char errbuf[1024];
@@
-712,17
+712,19
@@
static int openvpn_config (const char *key, const char *value)
temp->version = status_version;
temp->name = status_name;
temp->version = status_version;
temp->name = status_name;
- vpn_
list = (vpn_status_t **) 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)));
{
char errbuf[1024];
ERROR ("openvpn plugin: realloc failed: %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
+ sfree (vpn_list);
sfree (temp->file);
sfree (temp);
return (1);
}
sfree (temp->file);
sfree (temp);
return (1);
}
+ vpn_list = tmp_list;
vpn_list[vpn_num] = temp;
vpn_num++;
vpn_list[vpn_num] = temp;
vpn_num++;