Skip to content

Commit

Permalink
net_watcher: fix ringbuf memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
wxmzy88 committed Oct 10, 2024
1 parent f0afb06 commit 7e24729
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions eBPF_Supermarket/Network_Subsystem/net_watcher/netwatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,34 @@ int main(int argc, char **argv) {
}
}
cleanup:
if(rb)
ring_buffer__free(rb);
if(udp_rb)
ring_buffer__free(udp_rb);
if(netfilter_rb)
ring_buffer__free(netfilter_rb);
if(kfree_rb)
ring_buffer__free(kfree_rb);
if(icmp_rb)
ring_buffer__free(icmp_rb);
if(tcp_rb)
ring_buffer__free(tcp_rb);
if(dns_rb)
ring_buffer__free(dns_rb);
if(trace_rb)
ring_buffer__free(trace_rb);
if(mysql_rb)
ring_buffer__free(mysql_rb);
if(redis_rb)
ring_buffer__free(redis_rb);
if(redis_stat_rb)
ring_buffer__free(redis_stat_rb);
if(rtt_rb)
ring_buffer__free(rtt_rb);
if(events)
ring_buffer__free(events);
if(port_rb)
ring_buffer__free(port_rb);
netwatcher_bpf__destroy(skel);
return err < 0 ? -err : 0;
}

0 comments on commit 7e24729

Please sign in to comment.