code: fix memory leak
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user