]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
htp: minor cleanup to silence cppcheck warning
authorVictor Julien <victor@inliniac.net>
Mon, 9 Dec 2013 18:02:42 +0000 (19:02 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 9 Dec 2013 18:05:56 +0000 (19:05 +0100)
[src/app-layer-htp.c:1967] -> [src/app-layer-htp.c:1978]: (warning) \
    Possible null pointer dereference: tx - otherwise it is redundant \
    to check it against null.

src/app-layer-htp.c

index c8e140db490eb3dcce1754bf5d019ead017a2615..1cbcf73fcb2eb2faa587a279aae8592f6f68c5de 100644 (file)
@@ -1975,14 +1975,12 @@ static int HTPCallbackResponse(htp_tx_t *tx) {
     /* Unset the body inspection (if any) */
     hstate->flags &=~ HTP_FLAG_NEW_BODY_SET;
 
-    if (tx != NULL) {
-        HtpTxUserData *htud = (HtpTxUserData *) htp_tx_get_user_data(tx);
-        if (htud != NULL) {
-            if (htud->tcflags & HTP_FILENAME_SET) {
-                SCLogDebug("closing file that was being stored");
-                (void)HTPFileClose(hstate, NULL, 0, 0, STREAM_TOCLIENT);
-                htud->tcflags &= ~HTP_FILENAME_SET;
-            }
+    HtpTxUserData *htud = (HtpTxUserData *) htp_tx_get_user_data(tx);
+    if (htud != NULL) {
+        if (htud->tcflags & HTP_FILENAME_SET) {
+            SCLogDebug("closing file that was being stored");
+            (void)HTPFileClose(hstate, NULL, 0, 0, STREAM_TOCLIENT);
+            htud->tcflags &= ~HTP_FILENAME_SET;
         }
     }