]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: remove some useless tests
authorEric Leblond <el@stamus-networks.com>
Tue, 10 Jun 2025 18:34:38 +0000 (20:34 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 11 Jun 2025 18:49:19 +0000 (20:49 +0200)
src/detect-engine-alert.c

index 45f24329d40a61be44a28344d63c878fa911008b..4e697978a3f096654847caae962f5f25393cee44 100644 (file)
@@ -291,15 +291,12 @@ static inline int PacketAlertSetContext(
     if (det_ctx->json_content_len) {
         /* We have some JSON attached in the current detection so let's try
            to see if some need to be used for current signature. */
-        struct PacketContextData *current_json = pa->json_info;
+        struct PacketContextData *current_json = SCCalloc(1, sizeof(struct PacketContextData));
         if (current_json == NULL) {
-            current_json = SCCalloc(1, sizeof(struct PacketContextData));
-            if (current_json == NULL) {
-                /* Allocation error, let's return now */
-                return -1;
-            }
-            pa->json_info = current_json;
+            /* Allocation error, let's return now */
+            return -1;
         }
+        pa->json_info = current_json;
         for (size_t i = 0; i < det_ctx->json_content_len; i++) {
             if (s == det_ctx->json_content[i].id) {
                 if (current_json->json_string != NULL) {