Jeff Latimer : shell32: Fix possible dereference of NULL ptr.
Module: wine Branch: master Commit: f16e2c3a27a1e9bf15c376a8b6a484b3fa18cc10 URL: http://source.winehq.org/git/wine.git/?a=commit;h=f16e2c3a27a1e9bf15c376a8b6... Author: Jeff Latimer <lats(a)yless4u.com.au> Date: Sun Jun 10 17:42:50 2007 +1000 shell32: Fix possible dereference of NULL ptr. --- dlls/shell32/shelllink.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c index 0b7094a..aa21a4a 100644 --- a/dlls/shell32/shelllink.c +++ b/dlls/shell32/shelllink.c @@ -584,8 +584,12 @@ static HRESULT Stream_LoadString( IStream* stm, BOOL unicode, LPWSTR *pstr ) { count = MultiByteToWideChar( CP_ACP, 0, (LPSTR) temp, len, NULL, 0 ); str = HeapAlloc( GetProcessHeap(), 0, (count+1)*sizeof (WCHAR) ); - if( str ) - MultiByteToWideChar( CP_ACP, 0, (LPSTR) temp, len, str, count ); + if( !str ) + { + HeapFree( GetProcessHeap(), 0, temp ); + return E_OUTOFMEMORY; + } + MultiByteToWideChar( CP_ACP, 0, (LPSTR) temp, len, str, count ); HeapFree( GetProcessHeap(), 0, temp ); } else
participants (1)
-
Alexandre Julliard