Fix various minor clang/scan-build warnings.

remotes/origin/master-1.2.x
Victor Julien 15 years ago
parent 791fc2f6ea
commit c4b34e6ef7

@ -309,10 +309,6 @@ DecodeIPV6ExtHdrs(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt
/* set the header ptr first */
IPV6_EXTHDR_SET_FH(p, pkt);
nh = *pkt;
pkt += hdrextlen;
plen -= hdrextlen;
/* the rest is parsed upon reassembly */
SCReturn;

@ -227,11 +227,9 @@ static inline DetectDceOpnumData *DetectDceOpnumArgParse(const char *arg)
goto error;
if (prev_dor == NULL) {
prev_dor = dor;
dod->range = dor;
} else {
prev_dor->next = dor;
prev_dor = dor;
}
if (dup_str_head != NULL)
@ -349,7 +347,6 @@ void DetectDceOpnumFree(void *ptr)
if (dod != NULL) {
dor = dod->range;
dor_temp = dod->range;
while (dor != NULL) {
dor_temp = dor;
dor = dor->next;

@ -405,7 +405,6 @@ int DetectAddressInsert(DetectEngineCtx *de_ctx, DetectAddressHead *gh,
/* see if it already exists or overlaps with existing ag's */
if (head != NULL) {
cur = NULL;
r = 0;
for (cur = head; cur != NULL; cur = cur->next) {
r = DetectAddressCmp(new, cur);
@ -965,7 +964,7 @@ int DetectAddressParse2(DetectAddressHead *gh, DetectAddressHead *ghn, char *s,
o_set = 0;
} else if (d_set == 1) {
address[x - 1] = '\0';
x = 0;
rule_var_address = SCRuleVarsGetConfVar(address,
SC_RULE_VARS_ADDRESS_GROUPS);
if (rule_var_address == NULL)

@ -449,6 +449,7 @@ static void IPOnlyCIDRListSetSigNum(IPOnlyCIDRItem *tmphead, SigIntId i) {
}
}
#ifdef UNITTESTS
/**
* \brief This function print a IPOnlyCIDRItem list
* \param tmphead Pointer to the head of IPOnlyCIDRItems list
@ -466,6 +467,7 @@ static void IPOnlyCIDRListPrint(IPOnlyCIDRItem *tmphead) {
tmphead = tmphead->next;
}
}
#endif
/**
* \brief This function print a SigNumArray, it's used with the
@ -624,7 +626,7 @@ static IPOnlyCIDRItem *IPOnlyCIDRListParse2(char *s, int negate)
o_set = 0;
} else if (d_set == 1) {
address[x - 1] = '\0';
x = 0;
rule_var_address = SCRuleVarsGetConfVar(address,
SC_RULE_VARS_ADDRESS_GROUPS);
if (rule_var_address == NULL)

@ -1054,7 +1054,7 @@ static int DetectPortParseDo(DetectPort **head, DetectPort **nhead, char *s,
o_set = 0;
} else if (d_set == 1) {
address[x - 1] = '\0';
x = 0;
rule_var_port = SCRuleVarsGetConfVar(address,
SC_RULE_VARS_PORT_GROUPS);
if (rule_var_port == NULL)

@ -433,9 +433,6 @@ static inline void FlowForceReassemblyForQ(FlowQueue *q)
while (f != NULL) {
PACKET_RECYCLE(reassemble_p);
client_ok = 0;
server_ok = 0;
/* Get the tcp session for the flow */
ssn = (TcpSession *)f->protoctx;

@ -268,12 +268,10 @@ static TmEcode LogFileLogWrap(ThreadVars *tv, Packet *p, void *data, PacketQueue
SCLogDebug("write failed: %s", strerror(errno));
close(file_fd);
file_fd = -1;
continue;
}
close(file_fd);
file_fd = -1;
if (ff->state == FILE_STATE_CLOSED ||
ff->state == FILE_STATE_TRUNCATED ||

@ -291,7 +291,6 @@ TmEcode ReceivePcapLoop(ThreadVars *tv, void *data, void *slot)
r = PcapTryReopen(ptv);
} while (r < 0);
if (dbreak) {
r = 0;
break;
}
} else if (ptv->cb_result == TM_ECODE_FAILED) {

@ -1104,7 +1104,6 @@ static int HandleSegmentStartsBeforeListSegment(ThreadVars *tv, TcpReassemblyThr
if (end_after == TRUE || end_same == TRUE) {
StreamTcpSegmentDataReplace(list_seg, seg, overlap_point,
overlap);
end_after = FALSE;
} else {
SCLogDebug("using old data in starts before list case, "
"list_seg->seq %" PRIu32 " policy %" PRIu32 " "
@ -1297,7 +1296,6 @@ static int HandleSegmentStartsAtSameListSegment(ThreadVars *tv, TcpReassemblyThr
case OS_POLICY_HPUX11:
if (end_after == TRUE || end_same == TRUE) {
StreamTcpSegmentDataReplace(list_seg, seg, seg->seq, overlap);
end_after = FALSE;
} else {
SCLogDebug("using old data in starts at list case, "
"list_seg->seq %" PRIu32 " policy %" PRIu32 " "
@ -1498,7 +1496,6 @@ static int HandleSegmentStartsAfterListSegment(ThreadVars *tv, TcpReassemblyThre
case OS_POLICY_HPUX11:
if (end_after == TRUE) {
StreamTcpSegmentDataReplace(list_seg, seg, seg->seq, overlap);
end_after = FALSE;
} else {
SCLogDebug("using old data in starts beyond list case, "
"list_seg->seq %" PRIu32 " policy %" PRIu32 " "
@ -1970,8 +1967,6 @@ static int StreamTcpReassembleInlineAppLayer (ThreadVars *tv,
next_seq, seg->seq, stream->last_ack, gap_len);
#endif
next_seq = seg->seq;
/* We have missed the packet and end host has ack'd it, so
* IDS should advance it's ra_base_seq and should not consider this
* packet any longer, even if it is retransmitted, as end host will
@ -2128,8 +2123,6 @@ static int StreamTcpReassembleInlineAppLayer (ThreadVars *tv,
segment_done = TRUE;
}
}
} else {
payload_offset = 0;
}
}
@ -2460,8 +2453,6 @@ static int StreamTcpReassembleInlineRaw (TcpReassemblyThreadCtx *ra_ctx,
segment_done = TRUE;
}
}
} else {
payload_offset = 0;
}
}
@ -2665,9 +2656,6 @@ static int StreamTcpReassembleAppLayer (ThreadVars *tv,
"stream->last_ack %" PRIu32 ". Seq gap %" PRIu32"",
next_seq, seg->seq, stream->last_ack, gap_len);
#endif
next_seq = seg->seq;
/* We have missed the packet and end host has ack'd it, so
* IDS should advance it's ra_base_seq and should not consider this
* packet any longer, even if it is retransmitted, as end host will
@ -2861,8 +2849,6 @@ static int StreamTcpReassembleAppLayer (ThreadVars *tv,
segment_done = TRUE;
}
}
} else {
payload_offset = 0;
}
}
@ -3043,8 +3029,6 @@ static int StreamTcpReassembleRaw (TcpReassemblyThreadCtx *ra_ctx,
"stream->last_ack %" PRIu32 ". Seq gap %" PRIu32"",
next_seq, seg->seq, stream->last_ack, gap_len);
next_seq = seg->seq;
if (smsg == NULL) {
smsg = StreamMsgGetFromPool();
if (smsg == NULL) {
@ -3230,8 +3214,6 @@ static int StreamTcpReassembleRaw (TcpReassemblyThreadCtx *ra_ctx,
segment_done = TRUE;
}
}
} else {
payload_offset = 0;
}
}

@ -4467,7 +4467,6 @@ static int StreamTcpHandleTimestamp (TcpSession *ssn, Packet *p)
{
sender_stream->last_ts = ts;
sender_stream->last_pkt_ts = p->ts.tv_sec;
ret = 1;
SCLogDebug("timestamp considered valid anyway");
} else {

@ -486,15 +486,13 @@ int SCLogPrintFGFilters()
*/
int SCLogMatchFDFilter(const char *function)
{
#ifndef DEBUG
return 1;
#else
SCLogFDFilterThreadList *thread_list = NULL;
// pid_t self = syscall(SYS_gettid);
pthread_t self = pthread_self();
#ifndef DEBUG
return 1;
#endif
if (sc_log_module_initialized != 1) {
printf("Logging module not initialized. Call SCLogInitLogModule() "
"first before using the debug API\n");
@ -527,6 +525,7 @@ int SCLogMatchFDFilter(const char *function)
SCMutexUnlock(&sc_log_fd_filters_tl_m);
return 0;
#endif
}
/**
@ -575,10 +574,7 @@ int SCLogCheckFDFilterEntry(const char *function)
SCMutexLock(&sc_log_fd_filters_tl_m);
thread_list = sc_log_fd_filters_tl;
thread_list_temp = thread_list;
while (thread_list != NULL) {
thread_list_temp = thread_list;
if (pthread_equal(self, thread_list->t))
break;

@ -304,13 +304,15 @@ int SCHInfoAddHostOSInfo(char *host_os, char *host_os_ip_range, int is_ipv4)
}
if (recursive == TRUE) {
recursive = FALSE;
SCHInfoAddHostOSInfo(host_os, ip_str_rem, is_ipv4);
}
if (ip_str != NULL) SCFree(ip_str);
if (ipv4_addr != NULL) SCFree(ipv4_addr);
if (ipv6_addr != NULL) SCFree(ipv6_addr);
if (ip_str != NULL)
SCFree(ip_str);
if (ipv4_addr != NULL)
SCFree(ipv4_addr);
if (ipv6_addr != NULL)
SCFree(ipv6_addr);
return *user_data;
}

@ -96,7 +96,6 @@ void PrintRawDataFp(FILE *fp, uint8_t *buf, uint32_t buflen) {
for (u = 0; u < buflen; u+=16) {
fprintf(fp ," %04X ", u);
ch = 0;
for (ch = 0; (u+ch) < buflen && ch < 16; ch++) {
fprintf(fp, "%02X ", (uint8_t)buf[u+ch]);

@ -106,7 +106,6 @@ uint8_t *BasicSearchNocase(const uint8_t *haystack, uint32_t haystack_len, const
if (needle_len == 0 || needle_len > haystack_len)
return NULL;
n = needle;
for (n = needle; nmax - n <= hmax - haystack; haystack++) {
if (u8_tolower(*haystack) != u8_tolower(*n)) {
continue;

Loading…
Cancel
Save