[libdvdnav-devel] free(NULL) is a no-op

Jean-Baptiste Kempf git at videolan.org
Sat Aug 30 23:26:53 CEST 2014


libdvdread | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Aug 30 23:26:35 2014 +0200| [70d25decc685acfb072964ed8cf3de94bba6cbef] | committer: Jean-Baptiste Kempf

free(NULL) is a no-op

> http://git.videolan.org/gitweb.cgi/libdvdread.git/?a=commit;h=70d25decc685acfb072964ed8cf3de94bba6cbef
---

 src/dvd_reader.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/dvd_reader.c b/src/dvd_reader.c
index 00a3398..7af2730 100644
--- a/src/dvd_reader.c
+++ b/src/dvd_reader.c
@@ -603,14 +603,11 @@ dvd_reader_t *DVDOpen( const char *ppath )
 DVDOpen_error:
   /* If it's none of the above, screw it. */
   fprintf( stderr, "libdvdread: Could not open %s\n", path );
-  if( path != NULL )
-    free( path );
-  if ( path_copy != NULL )
-    free( path_copy );
+  free( path );
+  free( path_copy );
   if ( cdir >= 0 )
     close( cdir );
-  if ( new_path != NULL )
-    free( new_path );
+  free( new_path );
   return NULL;
 }
 



More information about the libdvdnav-devel mailing list