msi: Avoid a crash when target paths have not yet been resolved.

Hans Leidekker hans at codeweavers.com
Tue Nov 6 08:20:02 CST 2012


---
 dlls/msi/format.c |    9 ++++-----
 1 file 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++;
-- 
1.7.10.4






More information about the wine-patches mailing list