PATCH: shell objects touch deleted memory

Alberto Massari alby at exln.com
Thu Oct 24 15:37:03 CDT 2002


Hi folks,
I found that three COM objects are returning the reference count even when 
it touched 0 and the "This" object has been deleted.

Alberto

Here is the patch:

Index: dragdrophelper.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/dragdrophelper.c,v
retrieving revision 1.1
diff -u -r1.1 dragdrophelper.c
--- dragdrophelper.c    13 Aug 2002 03:21:53 -0000      1.1
+++ dragdrophelper.c    24 Oct 2002 20:28:48 -0000
@@ -122,8 +122,9 @@
      TRACE ("(%p)->(count=%lu)\n", This, This->ref);

      if (!--(This->ref)) {
-       TRACE ("-- destroying (%p)\n", This);
-       LocalFree ((HLOCAL) This);
+        TRACE("-- destroying (%p)\n", This);
+        LocalFree ((HLOCAL) This);
+        return 0;
      }
      return This->ref;
  }
Index: shfldr_desktop.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shfldr_desktop.c,v
retrieving revision 1.1
diff -u -r1.1 shfldr_desktop.c
--- shfldr_desktop.c    24 Jul 2002 01:56:03 -0000      1.1
+++ shfldr_desktop.c    24 Oct 2002 20:28:51 -0000
@@ -172,6 +172,7 @@
         if (This->sPathTarget)
             SHFree (This->sPathTarget);
         LocalFree ((HLOCAL) This);
+  return 0;
      }
      return This->ref;
  }
Index: shfldr_mycomp.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shfldr_mycomp.c,v
retrieving revision 1.1
diff -u -r1.1 shfldr_mycomp.c
--- shfldr_mycomp.c     24 Jul 2002 01:56:03 -0000      1.1
+++ shfldr_mycomp.c     24 Oct 2002 20:28:54 -0000
@@ -173,10 +173,11 @@
      TRACE ("(%p)->(count=%lu)\n", This, This->ref);

      if (!--(This->ref)) {
-       TRACE ("-- destroying IShellFolder(%p)\n", This);
-       if (This->pidlRoot)
-           SHFree (This->pidlRoot);
-       LocalFree ((HLOCAL) This);
+        TRACE ("-- destroying IShellFolder(%p)\n", This);
+        if (This->pidlRoot)
+            SHFree (This->pidlRoot);
+        LocalFree ((HLOCAL) This);
+        return 0;
      }
      return This->ref;
  }





More information about the wine-patches mailing list