[git] GnuPG - branch, master, updated. gnupg-2.1.11-158-g508b0de

by NIIBE Yutaka cvs at cvs.gnupg.org
Wed Apr 27 17:11:23 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  508b0deb70d39d388149be9a63fab24cc956a239 (commit)
      from  87de9e19edf0311ca0342e15ef44ebe40e32861e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 508b0deb70d39d388149be9a63fab24cc956a239
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Thu Apr 28 00:08:08 2016 +0900

    scd: Fix memory leaks.
    
    * scd/ccid-driver.c (scan_or_find_usb_device): Return on
    LIBUSB_ERROR_NO_MEM.  Free CONFIG before return except on error.
    (scan_or_find_devices): Free device list.
    
    --
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
index e968b83..601681f 100644
--- a/scd/ccid-driver.c
+++ b/scd/ccid-driver.c
@@ -1149,7 +1149,8 @@ scan_or_find_usb_device (int scan_mode,
       err = libusb_get_config_descriptor (dev, cfg_no, &config);
       if (err < 0)
         {
-          libusb_free_config_descriptor (config);
+          if (err == LIBUSB_ERROR_NO_MEM)
+            return err;
           continue;
         }
 
@@ -1232,6 +1233,7 @@ scan_or_find_usb_device (int scan_mode,
                                 {
                                   libusb_close (idev);
                                   free (rid);
+                                  libusb_free_config_descriptor (config);
                                   return 1; /* Out of core. */
                                 }
                               memcpy (*ifcdesc_extra, ifcdesc->extra,
@@ -1258,6 +1260,7 @@ scan_or_find_usb_device (int scan_mode,
                             free (rid);
 
                           *r_idev = idev;
+                          libusb_free_config_descriptor (config);
                           return 1; /* Found requested device. */
                         }
                       else
@@ -1273,10 +1276,13 @@ scan_or_find_usb_device (int scan_mode,
 
                   libusb_close (idev);
                   idev = NULL;
+                  libusb_free_config_descriptor (config);
                   return 0;
                 }
             }
         }
+
+      libusb_free_config_descriptor (config);
     }
 
   return 0;
@@ -1376,6 +1382,7 @@ scan_or_find_devices (int readerno, const char *readerid,
                                    interface_number,
                                    ep_bulk_out, ep_bulk_in, ep_intr))
         {
+          libusb_free_device_list (dev_list, 1);
           /* Found requested device or out of core. */
           if (!idev)
             {
@@ -1389,6 +1396,8 @@ scan_or_find_devices (int readerno, const char *readerid,
         }
     }
 
+  libusb_free_device_list (dev_list, 1);
+
   /* Now check whether there are any devices with special transport types. */
   for (i=0; transports[i].name; i++)
     {

-----------------------------------------------------------------------

Summary of changes:
 scd/ccid-driver.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list