]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
http: destroy htp_tx_t even if incomplete
authorVictor Julien <victor@inliniac.net>
Fri, 17 Jul 2015 13:31:56 +0000 (15:31 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 22 Jul 2015 10:13:43 +0000 (12:13 +0200)
src/app-layer-htp.c

index 8444afe651ed6b718b50b9cdb3840cf8443b6075..1a9c41a5c0ab9cf016ab721fd681758eab4ede9c 100644 (file)
@@ -408,6 +408,17 @@ static void HTPStateTransactionFree(void *state, uint64_t id)
         HtpTxUserDataFree(s, htud);
         htp_tx_set_user_data(tx, NULL);
 
+        /* hack: even if libhtp considers the tx incomplete, we want to
+         * free it here. htp_tx_destroy however, will refuse to do this.
+         * As htp_tx_destroy_incomplete isn't available in the public API,
+         * we hack around it here. */
+        if (unlikely(!(
+            tx->request_progress == HTP_REQUEST_COMPLETE &&
+            tx->response_progress == HTP_RESPONSE_COMPLETE)))
+        {
+            tx->request_progress = HTP_REQUEST_COMPLETE;
+            tx->response_progress = HTP_RESPONSE_COMPLETE;
+        }
         htp_tx_destroy(tx);
     }
 }