fix memory leak in cgroup-network
Costa Tsaousis (ktsaou) committed
May 29, 2018 at 03:03 UTC
fa0185e0c13791420461089688ed8ff92926a22c
1 file changed
+3
-2
src/cgroup-network.c
+3
-2
@@ -401,13 +401,13 @@ int send_devices(void) {
401
// since it switches namespaces, so after this call, everything is different!
402
403
void detect_veth_interfaces(pid_t pid) {
404
- struct iface *host, *cgroup, *h, *c;
404
+ struct iface *host = NULL, *cgroup = NULL, *h, *c;
405
406
host = read_proc_net_dev(netdata_configured_host_prefix);
407
if(!host) {
408
errno = 0;
409
error("cannot read host interface list.");
410
- return;
410
+ goto cleanup;
411
}
412
413
if(!eligible_ifaces(host)) {
@@ -446,6 +446,7 @@ void detect_veth_interfaces(pid_t pid) {
446
}
447
448
cleanup:
449
+ free_host_ifaces(cgroup);
450
free_host_ifaces(host);
451
}
452