diff options
| author | zhuzhenjun <[email protected]> | 2023-10-25 10:39:32 +0800 |
|---|---|---|
| committer | zhuzhenjun <[email protected]> | 2023-10-25 10:41:32 +0800 |
| commit | c9247d713da668ed1bd2d332849dd9409330c0e3 (patch) | |
| tree | 780744dd2250f31b82ef5c1ad5e673064b1930af /example/osfp_example.c | |
| parent | 8832411f2957ae8a37d3d6fbd4b3017247246fbd (diff) | |
code: fix memory leakv1.3.3
Diffstat (limited to 'example/osfp_example.c')
| -rw-r--r-- | example/osfp_example.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/example/osfp_example.c b/example/osfp_example.c index 7924e73..9d94015 100644 --- a/example/osfp_example.c +++ b/example/osfp_example.c @@ -25,6 +25,7 @@ #define VLAN_MAX_LAYER 2 +struct osfp_db *g_osfp_db; /* Port is just a uint16_t */ typedef uint16_t Port; @@ -496,6 +497,8 @@ void example_detect(struct osfp_db *osfp_db, Packet *p) fflush(stdout); } + free(json); + exit: if (result) { osfp_result_free(result); @@ -562,6 +565,8 @@ static void signal_handler(int signum) fflush(stdout); + osfp_db_free(g_osfp_db); + exit(0); } @@ -690,6 +695,8 @@ int main(int argc, char *argv[]) exit(1); } + g_osfp_db = osfp_db; + // loop while (1) { int r = pcap_dispatch(pcap_handle, 0, (pcap_handler)process_packet, (void*)osfp_db); |
