Module: wine Branch: master Commit: cfadbddcafa2b2ca3f515ac4d10c7e1b460a402b URL: http://source.winehq.org/git/wine.git/?a=commit;h=cfadbddcafa2b2ca3f515ac4d1...
Author: Hans Leidekker hans@codeweavers.com Date: Tue Nov 6 15:20:02 2012 +0100
msi: Avoid a crash when target paths have not yet been resolved.
---
dlls/msi/format.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/dlls/msi/format.c b/dlls/msi/format.c index 0bfd566..033f69c 100644 --- a/dlls/msi/format.c +++ b/dlls/msi/format.c @@ -221,7 +221,8 @@ static WCHAR *deformat_component( FORMAT *format, FORMSTR *str, int *ret_len ) else ret = strdupW( msi_get_target_folder( format->package, comp->Directory ) );
- *ret_len = strlenW( ret ); + if (ret) *ret_len = strlenW( ret ); + else *ret_len = 0; msi_free( key ); return ret; } @@ -238,14 +239,12 @@ static WCHAR *deformat_file( FORMAT *format, FORMSTR *str, BOOL shortname, int * if (!(file = msi_get_loaded_file( format->package, key ))) goto done; if (!shortname) { - ret = strdupW( file->TargetPath ); - len = strlenW( ret ); + if ((ret = strdupW( file->TargetPath ))) len = strlenW( ret ); goto done; } if ((len = GetShortPathNameW(file->TargetPath, NULL, 0)) <= 0) { - ret = strdupW( file->TargetPath ); - len = strlenW( ret ); + if ((ret = strdupW( file->TargetPath ))) len = strlenW( ret ); goto done; } len++;