Module: wine Branch: master Commit: a7cc44a6dbc279849a99d69111a8b86ede0b7e4a URL: http://source.winehq.org/git/wine.git/?a=commit;h=a7cc44a6dbc279849a99d69111...
Author: Marcus Meissner meissner@suse.de Date: Mon Jul 15 21:49:15 2013 +0200
winecfg: Free result in error nodes (Coverity).
---
programs/winecfg/winecfg.h | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/programs/winecfg/winecfg.h b/programs/winecfg/winecfg.h index e8289ea..b031497 100644 --- a/programs/winecfg/winecfg.h +++ b/programs/winecfg/winecfg.h @@ -154,7 +154,11 @@ static inline char *get_text(HWND dialog, WORD id) HWND item = GetDlgItem(dialog, id); int len = GetWindowTextLengthA(item) + 1; char *result = len ? HeapAlloc(GetProcessHeap(), 0, len) : NULL; - if (!result || GetWindowTextA(item, result, len) == 0) return NULL; + if (!result) return NULL; + if (GetWindowTextA(item, result, len) == 0) { + HeapFree (GetProcessHeap(), 0, result); + return NULL; + } return result; }
@@ -163,7 +167,11 @@ static inline WCHAR *get_textW(HWND dialog, WORD id) HWND item = GetDlgItem(dialog, id); int len = GetWindowTextLengthW(item) + 1; WCHAR *result = len ? HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)) : NULL; - if (!result || GetWindowTextW(item, result, len) == 0) return NULL; + if (!result) return NULL; + if(GetWindowTextW(item, result, len) == 0) { + HeapFree (GetProcessHeap(), 0, result); + return NULL; + } return result; }