diff options
author | Michael Adam <obnox@samba.org> | 2007-12-24 00:47:43 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2007-12-24 00:47:43 +0100 |
commit | 225dbe6c02e45b30541acb21f60cc20ddcfbf362 (patch) | |
tree | cf136a9030a6552523a934ee5aab0fb42d7777aa /source3/libnet | |
parent | 44860bce54d448316d2ac0bb9b0a2d0677d6c4eb (diff) | |
download | samba-225dbe6c02e45b30541acb21f60cc20ddcfbf362.tar.gz samba-225dbe6c02e45b30541acb21f60cc20ddcfbf362.tar.bz2 samba-225dbe6c02e45b30541acb21f60cc20ddcfbf362.zip |
Don't leak memory in libnet_smbconf_getparm().
Michael
(This used to be commit 09e62c765401102480d39a483bfffaf5a054babc)
Diffstat (limited to 'source3/libnet')
-rw-r--r-- | source3/libnet/libnet_conf.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 3a64c3d844..d9a9e7de9b 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -280,18 +280,24 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, struct registry_key *key = NULL; if (!libnet_smbconf_key_exists(mem_ctx, service)) { - return WERR_NO_SUCH_SERVICE; + werr = WERR_NO_SUCH_SERVICE; + goto done; } werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_READ, &key); - W_ERROR_NOT_OK_RETURN(werr); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } if (!libnet_smbconf_value_exists(mem_ctx, key, param)) { - return WERR_INVALID_PARAM; + werr = WERR_INVALID_PARAM; + goto done; } werr = reg_queryvalue(mem_ctx, key, param, value); +done: + TALLOC_FREE(key); return werr; } |