Am Donnerstag, den 14.07.2005, 07:34 -0500 schrieb Alexandre Julliard:
ChangeSet ID: 18925
Patch: http://cvs.winehq.org/patch.py?id=18925
Old revision New revision Changes Path 1.11 1.12 +4 -2 wine/programs/rundll32/rundll32.c
I try to learn, how to make good Patches for wine, but sometimes, it's difficult for me to understand: Why not being nice and Free the allocated Memory as in my Patch?
1) Just Save some Bytes of Code 2) This is done automatic, when the Program exit's
3) We are nice, and Free all our Resources.
If we are not nice, we can also:
Index: programs/rundll32/rundll32.c =================================================================== RCS file: /home/wine/wine/programs/rundll32/rundll32.c,v retrieving revision 1.12 diff -u -r1.12 rundll32.c --- programs/rundll32/rundll32.c 14 Jul 2005 12:34:04 -0000 1.12 +++ programs/rundll32/rundll32.c 14 Jul 2005 18:35:27 -0000 @@ -321,6 +321,5 @@ DestroyWindow(hWnd); if (hDll) FreeLibrary(hDll); - HeapFree(GetProcessHeap(),0,szDllName); return 0; /* rundll32 always returns 0! */ }
If we are nice, we need to insert :
Index: programs/rundll32/rundll32.c =================================================================== RCS file: /home/wine/wine/programs/rundll32/rundll32.c,v retrieving revision 1.12 diff -u -r1.12 rundll32.c --- programs/rundll32/rundll32.c 14 Jul 2005 12:34:04 -0000 1.12 +++ programs/rundll32/rundll32.c 14 Jul 2005 18:44:15 -0000 @@ -307,6 +307,8 @@ if (shell) pRunDLL_CallEntry16 = (void *)GetProcAddress( shell, (LPCSTR)122 ); if (pRunDLL_CallEntry16) pRunDLL_CallEntry16( entry_point, hWnd, instance, cmdline, info.wShowWindow ); + + FreeLibrary(shell); } else {
Detlef Riekenberg wine.dev@web.de writes:
I try to learn, how to make good Patches for wine, but sometimes, it's difficult for me to understand: Why not being nice and Free the allocated Memory as in my Patch?
- Just Save some Bytes of Code
- This is done automatic, when the Program exit's
Yes, there's no point in explicitly freeing memory on process exit, it's done automatically.