]> git.sur5r.net Git - openldap/commitdiff
Minor cleanup (coverity)
authorHoward Chu <hyc@symas.com>
Sun, 18 Jan 2015 14:27:19 +0000 (14:27 +0000)
committerHoward Chu <hyc@symas.com>
Sun, 18 Jan 2015 14:27:19 +0000 (14:27 +0000)
libraries/libldap/cyrus.c
libraries/libldap/dnssrv.c
libraries/libldap/filter.c
libraries/libldap/request.c

index 7c3ccbda4b67c4a2178d48ba0f3a2ea9e108a2d0..30969adcffb860b461ec8588bb9920151476819c 100644 (file)
@@ -1149,6 +1149,7 @@ void *ldap_pvt_sasl_mutex_new(void)
        if ( ldap_pvt_thread_mutex_init( mutex ) == 0 ) {
                return mutex;
        }
+       LDAP_FREE( mutex );
 #ifndef LDAP_DEBUG_R_SASL
        assert( 0 );
 #endif /* !LDAP_DEBUG_R_SASL */
index 51a711ac67322d8f234792d0f3ccd15229d889c2..915472e7be930c1d46d57ea2010a41e6f0cfc2e3 100644 (file)
@@ -361,12 +361,14 @@ int ldap_domain2hostlist(
                hostent_head[hostent_count].priority=priority;
                hostent_head[hostent_count].weight=weight;
                hostent_head[hostent_count].port=port;
-               strncpy(hostent_head[hostent_count].hostname, host, MAXHOST);
+               strncpy(hostent_head[hostent_count].hostname, host, MAXHOST-1);
+               hostent_head[hostent_count].hostname[MAXHOST-1] = '\0';
                hostent_count++;
            }
 add_size:;
            p += size;
        }
+       if (!hostent_head) goto out;
     qsort(hostent_head, hostent_count, sizeof(srv_record), srv_cmp);
 
        if (!srv_seed)
index 7b7bd88704ec8dc2d7ea292b839fb0a1dd911979..f6745170179fd16b722bba25361e702c6332c7bd 100644 (file)
@@ -77,7 +77,6 @@ static int ldap_is_oid ( const char *str )
                                dot=0;
 
                        } else if ( str[i] == '.' ) {
-                               if( dot ) return 0;
                                if( ++dot > 1 ) return 0;
 
                        } else {
@@ -120,7 +119,6 @@ static int ldap_is_desc ( const char *str )
                                dot=0;
 
                        } else if ( str[i] == '.' ) {
-                               if( dot ) return 0;
                                if( ++dot > 1 ) return 0;
 
                        } else {
@@ -938,7 +936,7 @@ ldap_put_vrFilter( BerElement *ber, const char *str_in )
        int rc =0;
        
        if ( ber_printf( ber, "{" /*"}"*/ ) == -1 ) {
-               rc = -1;
+               return -1;
        }
        
        rc = put_vrFilter( ber, str_in );
index 20a6c39ca0cba74f75da191c1cc70ad6a68dd383..d922d2d5440fb5b9c990974fb10ab29fb771e6be 100644 (file)
@@ -1438,6 +1438,7 @@ ldap_chase_referrals( LDAP *ld,
                    id, sref, srv, &rinfo.ri_request );
 
                if ( ber == NULL ) {
+                       ldap_free_urllist( srv );
                        return -1 ;
                }