]> git.sur5r.net Git - openldap/commitdiff
plug leaks
authorHoward Chu <hyc@openldap.org>
Fri, 31 Mar 2006 20:36:53 +0000 (20:36 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 31 Mar 2006 20:36:53 +0000 (20:36 +0000)
libraries/libldap/cyrus.c
libraries/libldap/schema.c
libraries/libldap/test.c
libraries/libldap/url.c

index 873387317a2f467f54d63fe4a8cb36506631dd2b..296e6337316ddfce5792b6eb65359b4d501e9002 100644 (file)
@@ -1024,7 +1024,7 @@ int ldap_pvt_sasl_secprops(
        sasl_security_properties_t *secprops )
 {
        int i, j, l;
-       char **props = ldap_str2charray( in, "," );
+       char **props;
        unsigned sflags = 0;
        int got_sflags = 0;
        sasl_ssf_t max_ssf = 0;
@@ -1034,7 +1034,11 @@ int ldap_pvt_sasl_secprops(
        unsigned maxbufsize = 0;
        int got_maxbufsize = 0;
 
-       if( props == NULL || secprops == NULL ) {
+       if( secprops == NULL ) {
+               return LDAP_PARAM_ERROR;
+       }
+       props = ldap_str2charray( in, "," );
+       if( props == NULL ) {
                return LDAP_PARAM_ERROR;
        }
 
index 820ae3a875e88af6d72ff0c092a7fa8cfd63c9b7..9e04633b009f73e3245fd20a34322a847fbf1860 100644 (file)
@@ -1414,16 +1414,20 @@ add_extension(LDAPSchemaExtensionItem ***extensions,
        if ( !*extensions ) {
                *extensions =
                  LDAP_CALLOC(2, sizeof(LDAPSchemaExtensionItem *));
-               if ( !*extensions )
-                 return 1;
+               if ( !*extensions ) {
+                       LDAP_FREE( ext );
+                       return 1;
+               }
                n = 0;
        } else {
                for ( n=0; (*extensions)[n] != NULL; n++ )
                        ;
                tmp = LDAP_REALLOC(*extensions,
                                   (n+2)*sizeof(LDAPSchemaExtensionItem *));
-               if ( !tmp )
+               if ( !tmp ) {
+                       LDAP_FREE( ext );
                        return 1;
+               }
                *extensions = tmp;
        }
        (*extensions)[n] = ext;
index 1affb1c71444e6e94ed9c61818a31d5147ee6e9c..88060893121c4fd5a198f3dc6072e40a618d2585 100644 (file)
@@ -205,6 +205,10 @@ get_modlist(
                                    6 ) == 0 ) {
                                        if ( file_read( tmp.mod_values[i] + 6,
                                            bvals[i] ) < 0 ) {
+                                               free( bvals );
+                                               for ( i = 0; i<num; i++ )
+                                                       free( result[ i ] );
+                                               free( result );
                                                return( NULL );
                                        }
                                } else {
index d3620152e9d65a73cf6a5dd968761946f89da422..c86e80e9ab9bc16bddcf429b45934cfeb2764a29 100644 (file)
@@ -1309,12 +1309,18 @@ ldap_url_parsehosts(
                                        specs[i] = ludp->lud_host;
                                        ludp->lud_host = p;
                                        p = strchr( ludp->lud_host, ']' );
-                                       if ( p == NULL )
+                                       if ( p == NULL ) {
+                                               LDAP_FREE(ludp);
+                                               ldap_charray_free(specs);
                                                return LDAP_PARAM_ERROR;
+                                       }
                                        *p++ = '\0';
                                        if ( *p != ':' ) {
-                                               if ( *p != '\0' )
+                                               if ( *p != '\0' ) {
+                                                       LDAP_FREE(ludp);
+                                                       ldap_charray_free(specs);
                                                        return LDAP_PARAM_ERROR;
+                                               }
                                                p = NULL;
                                        }
                                } else {
@@ -1328,6 +1334,8 @@ ldap_url_parsehosts(
                                ldap_pvt_hex_unescape(p);
                                ludp->lud_port = strtol( p, &next, 10 );
                                if ( next == p || next[0] != '\0' ) {
+                                       LDAP_FREE(ludp);
+                                       ldap_charray_free(specs);
                                        return LDAP_PARAM_ERROR;
                                }
                        }