WERROR regdb_open( void )
{
- WERROR result = WERR_OK;
- char *db_path;
+ WERROR result;
+ char *db_path = NULL;
int saved_errno;
if ( regdb ) {
DEBUG(10, ("regdb_open: incrementing refcount (%d->%d)\n",
regdb_refcount, regdb_refcount+1));
regdb_refcount++;
- return WERR_OK;
+ result = WERR_OK;
+ goto done;
}
db_path = state_path(talloc_tos(), "registry.tdb");
if (db_path == NULL) {
- return WERR_NOT_ENOUGH_MEMORY;
+ result = WERR_NOT_ENOUGH_MEMORY;
+ goto done;
}
become_root();
result = ntstatus_to_werror(map_nt_error_from_unix(saved_errno));
DEBUG(0,("regdb_open: Failed to open %s! (%s)\n",
db_path, strerror(saved_errno)));
- TALLOC_FREE(db_path);
- return result;
+ goto done;
}
- TALLOC_FREE(db_path);
regdb_refcount = 1;
DEBUG(10, ("regdb_open: registry db opened. refcount reset (%d)\n",
regdb_refcount));
- return WERR_OK;
+ result = WERR_OK;
+done:
+ TALLOC_FREE(db_path);
+ return result;
}
/***********************************************************************
buflen = value.dsize - len;
buf = (const char *)value.dptr + len;
- len = 0;
-
for (i = 0; i < num_items; i++) {
if (buflen == 0) {
break;