From: Andreas Schneider Date: Wed, 20 Feb 2013 09:03:13 +0000 (+0100) Subject: s4-registry: Don't leak memory on error. X-Git-Url: http://git.samba.org/?p=metze%2Fsamba%2Fwip.git;a=commitdiff_plain;h=66ee744ccbb0a57e651d76881328554dffab8bcd s4-registry: Don't leak memory on error. Reviewed-by: Alexander Bokovoy --- diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 1a4067bce353..dd154f78c94e 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -508,8 +508,15 @@ static char **reg_complete_key(const char *text, int start, int end) } else if(W_ERROR_EQUAL(status, WERR_NO_MORE_ITEMS)) { break; } else { + int n; + printf("Error creating completion list: %s\n", win_errstr(status)); + + for (n = j; n >= 0; n--) { + SAFE_FREE(matches[n]); + } + SAFE_FREE(matches); talloc_free(mem_ctx); return NULL; }