shell32[2/3]: don't free user supplied data in Shell_NotifyIcon if GetIconInfo failed

Mikołaj Zalewski mikolaj at zalewski.pl
Sun Mar 18 07:12:09 CDT 2007


We should free the nid and in such a case we were doing it.
-------------- next part --------------
From f8777c0736fdb3eeb1a465de9f3503d844714b4b Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Miko=C5=82aj_Zalewski?= <mikolaj at zalewski.pl>
Date: Sun, 18 Mar 2007 11:51:53 +0100
Subject: [PATCH] shell32: don't free user supplied data in Shell_NotifyIcon if GetIconInfo failed

---
 dlls/shell32/systray.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/dlls/shell32/systray.c b/dlls/shell32/systray.c
index 8e9f595..19465e2 100644
--- a/dlls/shell32/systray.c
+++ b/dlls/shell32/systray.c
@@ -89,6 +89,7 @@ BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW nid)
 {
     HWND tray;
     COPYDATASTRUCT cds;
+    char *buffer = NULL;
 
     TRACE("dwMessage = %d, nid->cbSize=%d\n", dwMessage, nid->cbSize);
 
@@ -102,7 +103,6 @@ BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW nid)
     if (nid->uFlags & NIF_ICON)
     {
         ICONINFO iconinfo;
-        char *buffer;
         BITMAP bmMask;
         BITMAP bmColour;
         LONG cbMaskBits;
@@ -156,8 +156,7 @@ noicon:
 
     /* FIXME: if statement only needed because we don't support interprocess
      * icon handles */
-    if (nid->uFlags & NIF_ICON)
-        HeapFree(GetProcessHeap(), 0, cds.lpData);
+    HeapFree(GetProcessHeap(), 0, buffer);
 
     return TRUE;
 }
-- 
1.4.4.2


More information about the wine-patches mailing list