Uninitialised variable in TASK_Create

Saulius Krasuckas Saulius.Krasuckas at elst.vtu.lt
Sun Jun 29 15:42:49 CDT 2003


> Hi,
>
> There is an unintialised string (the name variable) in TASK_Create in
> task.c (visible if you run almost any program with --debugmsg +task).
> I would try and fix the problem but I have no idea what the correct
> fix is. Is this just a case of adding *name = 0?
>
> Rob

  hello,
  (heh, i've lost the race.. :P)

  cents:
  i have found patch, which made my valgrind to scream bout the same
issue:

http://cvs.winehq.com/patch.py?root=/home/winehq/opt/cvs-commit&id=8245

Index: wine/loader/task.c
diff -u wine/loader/task.c:1.132 wine/loader/task.c:1.133
--- wine/loader/task.c:1.132	Sun Jun 29 20:22:43 2003
+++ wine/loader/task.c	Sun Jun 29 20:22:43 2003
<skipped>
@@ -299,13 +300,16 @@

       /* Copy the module name */

-    GetModuleName16( pModule->self, name, sizeof(name) );
-    strncpy( pTask->module_name, name, sizeof(pTask->module_name) );
+    if (hModule)
+    {
+        GetModuleName16( hModule, name, sizeof(name) );
+        strncpy( pTask->module_name, name, sizeof(pTask->module_name) );
+    }


  in addition to null-initializing the "name", i'd add this at several
page-downs:

-    pTask->compat_flags = GetProfileIntA( "Compatibility", name, 0 );
+    if(name)
+    {
+      pTask->compat_flags = GetProfileIntA( "Compatibility", name, 0 );
+    }

  IMHO we'd "save" two api-calls (GetProfileIntA() ant
GetPrivateProfileIntA()) using such check.




More information about the wine-devel mailing list