[h5py] 294/455: Fix identifier leak

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:43 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag 1.3.0
in repository h5py.

commit 5d71b2111ef20931f2bd567f8ff1f42629a0a25b
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Sat Jun 27 05:11:34 2009 +0000

    Fix identifier leak
---
 h5py/typeproxy.c | 42 ++++++++++++++----------------------------
 1 file changed, 14 insertions(+), 28 deletions(-)

diff --git a/h5py/typeproxy.c b/h5py/typeproxy.c
index 5dc3dd1..305c1a4 100644
--- a/h5py/typeproxy.c
+++ b/h5py/typeproxy.c
@@ -324,63 +324,49 @@ htri_t h5py_detect_vlen(hid_t type_id){
     int     i;
 
     typeclass = H5Tget_class(type_id);
-    if(typeclass<0) goto failed;
+    if(typeclass<0) return -1;
 
     switch(typeclass){
 
         case H5T_STRING:
-            retval = H5Tis_variable_str(type_id);
-            break;
+            return H5Tis_variable_str(type_id);
 
         case H5T_VLEN:
-            retval = 1;
-            break;
+            return 1;
 
         case H5T_ARRAY:
             stype = H5Tget_super(type_id);
             if(stype<0){
-                retval = -1;
-                break;
+                return -1;
             }
             retval = h5py_detect_vlen(stype);
-            break;
+            H5Tclose(stype);
+            return retval;
 
         case H5T_COMPOUND:
             nmembers = H5Tget_nmembers(type_id);
             if(nmembers<0){
-                retval = -1;
-                break;
+                return -1;
             }
             for(i=0;i<nmembers;i++){
                 stype = H5Tget_member_type(type_id, i);
                 if(stype<0){
-                    retval = -1;
-                    break;
+                    return -1;
                 }
                 retval = h5py_detect_vlen(stype);
-                if(retval!=0){
-                    break;
+                if(retval!=0){ /* short-circuit success */
+                    H5Tclose(stype);
+                    return retval;
                 }
+                H5Tclose(stype);
             }
-            break;
+            return 0;
 
         default:
-            retval = 0;
+            return 0;
 
     } /* switch */
 
-
-    out:        /* cleanup */
-
-    if(stype>0)     H5Tclose(stype);
-    
-    return retval;
-
-    failed:     /* error target */
-
-    retval = -1;
-    goto out;
-
 }
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/h5py.git



More information about the debian-science-commits mailing list