]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
coverity fixes
authorAnoop Saldanha <poonaatsoc@gmail.com>
Wed, 2 May 2012 08:10:08 +0000 (13:40 +0530)
committerVictor Julien <victor@inliniac.net>
Wed, 2 May 2012 08:17:20 +0000 (10:17 +0200)
src/app-layer-parser.c
src/decode-udp.h
src/flow-timeout.c
src/log-pcap.c
src/tmqh-flow.c

index 8545343977cd3b0fe0aa5abcf189174ab35f4555..d4f2b8b0be8b424f6a3b5541196ca798a26a514e 100644 (file)
@@ -1230,6 +1230,7 @@ void AppLayerListSupportedProtocols(void)
 {
     uint32_t i;
     uint32_t temp_alprotos_buf[ALPROTO_MAX];
+    memset(temp_alprotos_buf, 0, sizeof(temp_alprotos_buf));
 
     printf("=========Supported App Layer Protocols=========\n");
 
index 4f24892d601b60b1c735c9c94d487811497d6fa6..037a91f3b4f7c229dca1860a5c27d4066ff50197 100644 (file)
@@ -189,8 +189,6 @@ static inline uint16_t UDPV6CalculateChecksum(uint16_t *shdr, uint16_t *pkt,
         return 0xFFFF;
     else
         return csum_u16;
-
-    return (uint16_t)~csum;
 }
 
 
index 3d2920a255f2fb600e48953fd29abbe7b24ec8d6..669d52228a16314dd7a6ffd69a3cf76c9169d6cb 100644 (file)
@@ -487,7 +487,11 @@ static inline void FlowForceReassemblyForHash(void)
                 StreamTcpReassembleHandleSegment(stream_pseudo_pkt_stream_TV,
                         stt->ra_ctx, ssn, &ssn->server,
                         reassemble_p, NULL);
-                StreamTcpReassembleProcessAppLayer(stt->ra_ctx);
+                if (StreamTcpReassembleProcessAppLayer(stt->ra_ctx) < 0) {
+                    SCLogDebug("shutdown flow timeout "
+                               "StreamTcpReassembleProcessAppLayer() erroring "
+                               "over something");
+                }
             }
             /* oh oh!  We have some unattended toclient segments */
             if ((server_ok = StreamHasUnprocessedSegments(ssn, 1)) == 1) {
@@ -500,7 +504,11 @@ static inline void FlowForceReassemblyForHash(void)
                 StreamTcpReassembleHandleSegment(stream_pseudo_pkt_stream_TV,
                         stt->ra_ctx, ssn, &ssn->client,
                         reassemble_p, NULL);
-                StreamTcpReassembleProcessAppLayer(stt->ra_ctx);
+                if (StreamTcpReassembleProcessAppLayer(stt->ra_ctx) < 0) {
+                    SCLogDebug("shutdown flow timeout "
+                               "StreamTcpReassembleProcessAppLayer() erroring "
+                               "over something");
+                }
             }
 
             if (ssn->state >= TCP_ESTABLISHED && ssn->state != TCP_CLOSED)
index 023d9ec0458811d59f529be1665dc20c0c3154be..05f31df227b02c522d0fad2185a7025e52692bdf 100644 (file)
@@ -417,8 +417,7 @@ OutputCtx *PcapLogInitCtx(ConfNode *conf)
         filename = DEFAULT_LOG_FILENAME;
 
     if ((pl->prefix = SCStrdup(filename)) == NULL) {
-        SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory for directory name");
-        return NULL;
+        exit(EXIT_FAILURE);
     }
 
     pl->size_limit = DEFAULT_LIMIT;
@@ -576,6 +575,9 @@ OutputCtx *PcapLogInitCtx(ConfNode *conf)
 
 static void PcapLogFileDeInitCtx(OutputCtx *output_ctx)
 {
+    if (output_ctx == NULL)
+        return;
+
     PcapLogData *pl = output_ctx->data;
 
     PcapFileName *pf = NULL;
@@ -583,10 +585,6 @@ static void PcapLogFileDeInitCtx(OutputCtx *output_ctx)
         SCLogDebug("PCAP files left at exit: %s\n", pf->filename);
     }
 
-    if (output_ctx != NULL) {
-        SCFree(output_ctx);
-    }
-
     return;
 }
 
index 1382e5b60a1a4cd4c5e116500aa940367f7314e8..a78c471f5cc0684ce3f185e8527ab7b3d3387ef3 100644 (file)
@@ -119,10 +119,10 @@ static int StoreQueueId(TmqhFlowCtx *ctx, char *name)
     if (ctx->queues == NULL) {
         ctx->size = 1;
         ctx->queues = SCMalloc(ctx->size * sizeof(TmqhFlowMode));
-        memset(ctx->queues, 0, ctx->size * sizeof(TmqhFlowMode));
         if (ctx->queues == NULL) {
             return -1;
         }
+        memset(ctx->queues, 0, ctx->size * sizeof(TmqhFlowMode));
     } else {
         ctx->size++;
         ctx->queues = SCRealloc(ctx->queues, ctx->size * sizeof(TmqhFlowMode));