diff options
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/dbwrap_ctdb.c | 12 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf_reg.c | 13 |
2 files changed, 15 insertions, 10 deletions
diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c index 03667ff355..4a5bf6d81a 100644 --- a/source3/lib/dbwrap_ctdb.c +++ b/source3/lib/dbwrap_ctdb.c @@ -121,9 +121,9 @@ static struct ctdb_marshall_buffer *db_ctdb_marshall_add(TALLOC_CTX *mem_ctx, { struct ctdb_rec_data *r; size_t m_size, r_size; - struct ctdb_marshall_buffer *m2; + struct ctdb_marshall_buffer *m2 = NULL; - r = db_ctdb_marshall_record(mem_ctx, reqid, key, header, data); + r = db_ctdb_marshall_record(talloc_tos(), reqid, key, header, data); if (r == NULL) { talloc_free(m); return NULL; @@ -133,7 +133,7 @@ static struct ctdb_marshall_buffer *db_ctdb_marshall_add(TALLOC_CTX *mem_ctx, m = (struct ctdb_marshall_buffer *)talloc_zero_size( mem_ctx, offsetof(struct ctdb_marshall_buffer, data)); if (m == NULL) { - return NULL; + goto done; } m->db_id = db_id; } @@ -145,15 +145,15 @@ static struct ctdb_marshall_buffer *db_ctdb_marshall_add(TALLOC_CTX *mem_ctx, mem_ctx, m, m_size + r_size); if (m2 == NULL) { talloc_free(m); - return NULL; + goto done; } memcpy(m_size + (uint8_t *)m2, r, r_size); - talloc_free(r); - m2->count++; +done: + talloc_free(r); return m2; } diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c index 5a5c0ead65..ae6a41151d 100644 --- a/source3/lib/smbconf/smbconf_reg.c +++ b/source3/lib/smbconf/smbconf_reg.c @@ -80,12 +80,20 @@ static WERROR smbconf_reg_open_service_key(TALLOC_CTX *mem_ctx, uint32 desired_access, struct registry_key **key) { + WERROR werr; + if (servicename == NULL) { *key = rpd(ctx)->base_key; return WERR_OK; } - return reg_openkey(mem_ctx, rpd(ctx)->base_key, servicename, + werr = reg_openkey(mem_ctx, rpd(ctx)->base_key, servicename, desired_access, key); + + if (W_ERROR_EQUAL(werr, WERR_BADFILE)) { + werr = WERR_NO_SUCH_SERVICE; + } + + return werr; } /** @@ -828,9 +836,6 @@ static WERROR smbconf_reg_get_share(struct smbconf_ctx *ctx, werr = smbconf_reg_open_service_key(tmp_ctx, ctx, servicename, REG_KEY_READ, &key); if (!W_ERROR_IS_OK(werr)) { - if (W_ERROR_EQUAL(werr, WERR_BADFILE)) { - werr = WERR_NO_SUCH_SERVICE; - } goto done; } |