From 66ee744ccbb0a57e651d76881328554dffab8bcd Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 20 Feb 2013 10:03:13 +0100 Subject: s4-registry: Don't leak memory on error. Reviewed-by: Alexander Bokovoy --- source4/lib/registry/tools/regshell.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 1a4067bce3..dd154f78c9 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; } -- cgit