libtt: Fix some uninitialized variables detected by Coverity

This commit is contained in:
Matthew Howkins
2014-12-30 17:24:31 +00:00
committed by Peter Howkins
parent 8ed5281e3e
commit be49dc56bc
5 changed files with 16 additions and 14 deletions

View File

@@ -1159,7 +1159,7 @@ _tt_pattern_context_add(Tt_pattern p, const char *slotname, const char *value)
{
_Tt_pattern_ptr pat = _tt_htab->lookup_pat(p);
_Tt_pat_context_ptr cntxt;
Tt_status status;
Tt_status status = TT_OK;
int add = 0;
cntxt = pat->context(slotname);
@@ -1175,7 +1175,7 @@ _tt_pattern_context_add(Tt_pattern p, const char *slotname, const char *value)
add = 1;
}
// NULL value means leave value unset (which matches everything)
if (value != (char *)0) {
if (value != NULL) {
_Tt_string valString(value);
status = cntxt->addValue(valString);
if (status != TT_OK) {
@@ -1277,7 +1277,7 @@ _tt_pattern_bcontext_add(Tt_pattern p, const char *slotname,
{
_Tt_pattern_ptr pat = _tt_htab->lookup_pat(p);
_Tt_pat_context_ptr cntxt;
Tt_status status;
Tt_status status = TT_OK;
int add = 0;
@@ -1294,7 +1294,7 @@ _tt_pattern_bcontext_add(Tt_pattern p, const char *slotname,
add = 1;
}
// NULL value means leave value unset (which matches everything)
if (value != (unsigned char *)0) {
if (value != NULL) {
_Tt_string valString( value, len );
status = cntxt->addValue( valString );

View File

@@ -178,7 +178,8 @@ init(int init_as_source)
#else
int len;
#endif
int optval;
int optval = 1;
_sock = socket(AF_INET, SOCK_STREAM, 0);
if (_sock < 0) {
_tt_syslog( 0, LOG_ERR,
@@ -194,7 +195,6 @@ init(int init_as_source)
_is_source = init_as_source;
if (init_as_source) { /* 'from' end of socket */
#if !defined(OPT_TLI)
optval = 1;
#ifndef linux
if (setsockopt(_sock, SOL_SOCKET, SO_USELOOPBACK,
(char *)&optval, sizeof(int)) == -1) {