From c263c38cdf2b2630037449e8920dda2b46535954 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Fri, 20 Jun 2014 10:57:57 +0200 Subject: [PATCH] statedb.c: fix potential memory leak on win32 This fixes coverity issue 12898 --- csync/src/csync_statedb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/csync/src/csync_statedb.c b/csync/src/csync_statedb.c index f62adcb05..c593b423d 100644 --- a/csync/src/csync_statedb.c +++ b/csync/src/csync_statedb.c @@ -69,12 +69,13 @@ static void _csync_win32_hide_file( const char *file ) { fileName = c_utf8_to_locale( file ); dwAttrs = GetFileAttributesW(fileName); - if (dwAttrs==INVALID_FILE_ATTRIBUTES) return; + if (dwAttrs==INVALID_FILE_ATTRIBUTES) goto cleanup; if (!(dwAttrs & FILE_ATTRIBUTE_HIDDEN)) { SetFileAttributesW(fileName, dwAttrs | FILE_ATTRIBUTE_HIDDEN ); } +cleanup: c_free_locale_string(fileName); #else (void) file;