Commit 6dac9715 authored by 's avatar
Browse files

Fixed some memory leaks


git-svn-id: file:///home/svn/mapi/trunk@366 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 79d984bb
......@@ -422,6 +422,16 @@ static int cook_process(mapidflib_function_instance_t *instance,MAPI_UNUSED unsi
stream= find_stream(tcph,iph,&from_client,flow->id);
if(stream) {
fprintf(stderr,"\tStream found\n");
if(headers != NULL) {
if(headers->header != NULL) {
free(headers->header);
headers->header = NULL;
}
free(headers);
headers = NULL;
}
headers = malloc(sizeof(struct headers_data));
headers->header = malloc(pkt_head->caplen); //added 100 more bytes
memcpy(headers->header,link_pkt,pkt_head->caplen);
......@@ -483,6 +493,15 @@ static int cook_process(mapidflib_function_instance_t *instance,MAPI_UNUSED unsi
create_mod_pkt((unsigned char *)link_pkt,flow,pkt_head);
memcpy(link_pkt, flow->mod_pkt, pkt_head->caplen);
flow->cooked = 1;
if(headers != NULL) {
if(headers->header != NULL) {
free(headers->header);
headers->header = NULL;
}
free(headers);
headers = NULL;
}
return 1;
}
......
......@@ -526,6 +526,8 @@ int nids_mapi_init(pcap_t *d,int ltype,int id)
init_procs(id);
tcp_init(nids_params.n_tcp_streams,id);
ip_frag_init(nids_params.n_hosts,id);
nids_params.scan_num_hosts = 0;
nids_params.scan_num_ports = 0;
scan_init();
return 1;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment