Hi,
Really the patch submitted is not correct, but, the problem persists.
iupwin_menu leaks the image handler.

in (iup_image.c), function: iupImageGetImage

if function iImageGetImageFromName fail, is executed this:

    handle = iupdrvImageLoad(name, IUPIMAGE_IMAGE);
    if (handle) 
      return handle;

iupdrvImageLoad dot not store handle in the cache, in this way,
iupwin_menu.c still leaks.

Best regards,
Ranier Vilela

________________________________________
De: Antonio Scuri <antonio.sc...@gmail.com>
Enviado: sexta-feira, 26 de janeiro de 2018 19:44
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

  Those DeleteObject(hBitmap*) can not be called. They are stored in a cache 
inside the IupImage, they will be released later when the image is destroyed.

Best,
Scuri


2018-01-24 22:30 GMT-02:00 Ranier VF 
<ranier_...@hotmail.com<mailto:ranier_...@hotmail.com>>:
Hi,
Issue found by Coverity Scan.
CID 259189 (#1-2 of 2): Resource leak (RESOURCE_LEAK)

--- a\src\win\iupwin_menu.c     Mon Dec 11 14:52:42 2017
+++ b\src\win\iupwin_menu.c     Wed Jan 24 22:26:33 2018
@@ -431,9 +431,13 @@
     hBitmapChecked = hBitmapUnchecked;

   SetMenuItemBitmaps((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND, 
hBitmapUnchecked, hBitmapChecked);
-
   winMenuUpdateBar(ih);

+  if (impress)
+  {
+     DeleteObject(hBitmapChecked);
+  }
+
   return 1;
 }

@@ -450,8 +454,13 @@
     hBitmapChecked = hBitmapUnchecked;

   SetMenuItemBitmaps((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND, 
hBitmapUnchecked, hBitmapChecked);
-
   winMenuUpdateBar(ih);
+
+  if (value)
+  {
+    DeleteObject(hBitmapChecked);
+  }
+  DeleteObject(hBitmapunChecked);

   return 1;
 }

Best.
Ranier Vilela
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to