Don't segfault when trying to delete a key when none exist.
authorJim McDonough <jmcd@samba.org>
Tue, 3 Dec 2002 19:24:51 +0000 (19:24 +0000)
committerJim McDonough <jmcd@samba.org>
Tue, 3 Dec 2002 19:24:51 +0000 (19:24 +0000)
(This used to be commit 1bf36d3fc69b8129fff08f5a735e27a94eb46d49)

source3/registry/reg_objects.c

index be15e49a2f794933bb462d75e9026c25a1d883c8..e63732115399b37486d72049a7f067345dcb6d6c 100644 (file)
@@ -313,6 +313,8 @@ int regval_ctr_delvalue( REGVAL_CTR *ctr, char *name )
        int     i;
        
        /* search for the value */
+       if (!(ctr->num_values))
+               return 0;
        
        for ( i=0; i<ctr->num_values; i++ ) {
                if ( strcmp( ctr->values[i]->valuename, name ) == 0)