From 3177cece659b12114e37033a22becc595649d07a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 24 Dec 2007 01:03:14 +0100 Subject: [PATCH] Do not leak memory in libnet_smbconf_delparm(). Michael (This used to be commit 49cfe2b9ebe03d5985187890445b775047f8a2f4) --- source3/libnet/libnet_conf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 4945413bb1b..a371915a361 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -311,14 +311,19 @@ WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx, } werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_ALL, &key); - W_ERROR_NOT_OK_RETURN(werr); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } if (!libnet_smbconf_value_exists(key, param)) { - return WERR_INVALID_PARAM; + werr = WERR_INVALID_PARAM; + goto done; } werr = reg_deletevalue(key, param); +done: + TALLOC_FREE(key); return werr; } -- 2.34.1