]> git.sesse.net Git - vlc/blobdiff - modules/access/vcd/vcd.c
vcd: fix potential NULL-dereference (found with cocinnelle static analyser).
[vlc] / modules / access / vcd / vcd.c
index b8742cd76f3ab5bde74019397a06f83700bd0a7d..0b62bc2592ea89c7a97d991a9a8a5a7fbee14861 100644 (file)
@@ -85,7 +85,7 @@ struct access_sys_t
 };
 
 static block_t *Block( access_t * );
-static int      Seek( access_t *, int64_t );
+static int      Seek( access_t *, uint64_t );
 static int      Control( access_t *, int, va_list );
 static int      EntryPoints( access_t * );
 
@@ -136,12 +136,10 @@ static int Open( vlc_object_t *p_this )
 #endif
 
     /* Open VCD */
-    if( !(vcddev = ioctl_Open( p_this, psz_dup )) )
-    {
-        free( psz_dup );
-        return VLC_EGENERIC;
-    }
+    vcddev = ioctl_Open( p_this, psz_dup );
     free( psz_dup );
+    if( !vcddev )
+        return VLC_EGENERIC;
 
     /* Set up p_access */
     p_access->pf_read = NULL;
@@ -218,7 +216,7 @@ static int Open( vlc_object_t *p_this )
     return VLC_SUCCESS;
 
 error:
-    ioctl_Close( VLC_OBJECT(p_access), p_sys->vcddev );
+    ioctl_Close( VLC_OBJECT(p_access), vcddev );
     free( p_sys );
     return VLC_EGENERIC;
 }
@@ -305,7 +303,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
                 p_sys->i_sector = p_sys->p_sectors[1+p_access->info.i_title] +
                     t->seekpoint[i]->i_byte_offset / VCD_DATA_SIZE;
 
-                p_access->info.i_pos = (int64_t)(p_sys->i_sector -
+                p_access->info.i_pos = (uint64_t)(p_sys->i_sector -
                     p_sys->p_sectors[1+p_access->info.i_title]) *VCD_DATA_SIZE;
             }
             return VLC_SUCCESS;
@@ -408,7 +406,7 @@ static block_t *Block( access_t *p_access )
 /*****************************************************************************
  * Seek:
  *****************************************************************************/
-static int Seek( access_t *p_access, int64_t i_pos )
+static int Seek( access_t *p_access, uint64_t i_pos )
 {
     access_sys_t *p_sys = p_access->p_sys;
     input_title_t *t = p_sys->title[p_access->info.i_title];