OSDN Git Service

libhb: close file handle after querying dvd region mask from drive
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 24 Jul 2009 20:39:22 +0000 (20:39 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 24 Jul 2009 20:39:22 +0000 (20:39 +0000)
this only affected linux since we only query the region mask on linux

git-svn-id: svn://localhost/HandBrake/trunk@2729 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/ports.c

index 7b18ce8..6368bcb 100644 (file)
@@ -103,12 +103,19 @@ int hb_dvd_region(char *device, int *region_mask)
     if ( fd < 0 )
         return -1;
     if ( fstat( fd, &st ) < 0 )
+       {
+        close( fd );
         return -1;
+       }
     if ( !( S_ISBLK( st.st_mode ) || S_ISCHR( st.st_mode ) ) )
+       {
+        close( fd );
         return -1;
+       }
 
     ai.type = DVD_LU_SEND_RPC_STATE;
     ret = ioctl(fd, DVD_AUTH, &ai);
+    close( fd );
     if ( ret < 0 )
         return ret;