|
@@ -343,7 +343,9 @@ err:
|
|
|
*/
|
|
|
int remove_flow(flow *f) {
|
|
|
|
|
|
- EVP_MD_CTX_destroy(f->finish_md_ctx);
|
|
|
+ if(f->finish_md_ctx){
|
|
|
+ EVP_MD_CTX_destroy(f->finish_md_ctx);
|
|
|
+ }
|
|
|
//Clean up cipher ctxs
|
|
|
if(f->clnt_read_ctx != NULL){
|
|
|
EVP_CIPHER_CTX_free(f->clnt_read_ctx);
|
|
@@ -358,7 +360,6 @@ int remove_flow(flow *f) {
|
|
|
EVP_CIPHER_CTX_free(f->srvr_write_ctx);
|
|
|
}
|
|
|
|
|
|
- sem_wait(&flow_table_lock);
|
|
|
flow_entry *entry = table->first_entry;
|
|
|
if(entry->f == f){
|
|
|
table->first_entry = entry->next;
|
|
@@ -390,7 +391,8 @@ int remove_flow(flow *f) {
|
|
|
entry = next;
|
|
|
}
|
|
|
}
|
|
|
- sem_post(&flow_table_lock);
|
|
|
+
|
|
|
+ f = NULL;
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
@@ -413,6 +415,8 @@ int grow_table() {
|
|
|
*/
|
|
|
flow *check_flow(flow observed){
|
|
|
/* Loop through flows in table and see if it exists */
|
|
|
+
|
|
|
+ sem_wait(&flow_table_lock);
|
|
|
int i;
|
|
|
flow_entry *entry = table->first_entry;
|
|
|
flow *candidate;
|
|
@@ -420,7 +424,6 @@ flow *check_flow(flow observed){
|
|
|
if(entry == NULL)
|
|
|
return NULL;
|
|
|
|
|
|
- sem_wait(&flow_table_lock);
|
|
|
/* Check first in this direction */
|
|
|
for(i=0; i<table->len; i++){
|
|
|
if(entry == NULL){
|