[libdvdcss-devel] Drop unnecessary NULL check before free().

Diego Biurrun git at videolan.org
Thu Oct 30 17:16:29 CET 2014


libdvdcss | branch: master | Diego Biurrun <diego at biurrun.de> | Wed Oct 22 13:00:01 2014 +0200| [125f5e4f764847326b57762c512e8725c837a8b4] | committer: Diego Biurrun

Drop unnecessary NULL check before free().

> http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=125f5e4f764847326b57762c512e8725c837a8b4
---

 src/device.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/device.c b/src/device.c
index d16557e..5ac5175 100644
--- a/src/device.c
+++ b/src/device.c
@@ -450,12 +450,9 @@ int _dvdcss_close ( dvdcss_t dvdcss )
     }
 
     /* Free readv temporary buffer */
-    if( dvdcss->p_readv_buffer )
-    {
-        free( dvdcss->p_readv_buffer );
-        dvdcss->p_readv_buffer   = NULL;
-        dvdcss->i_readv_buf_size = 0;
-    }
+    free( dvdcss->p_readv_buffer );
+    dvdcss->p_readv_buffer   = NULL;
+    dvdcss->i_readv_buf_size = 0;
 
     return 0;
 #else
@@ -926,7 +923,7 @@ static int win_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
     {
         dvdcss->i_readv_buf_size = i_blocks * DVDCSS_BLOCK_SIZE;
 
-        if( dvdcss->p_readv_buffer ) free( dvdcss->p_readv_buffer );
+        free( dvdcss->p_readv_buffer );
 
         /* Allocate a buffer which will be used as a temporary storage
          * for readv */



More information about the libdvdcss-devel mailing list