shithub: libdvdcss

Download patch

ref: 001afc48ac34b343c4b7fee858856bf3df540cdf
parent: 1ecbd379c4f9c768553bfc13ee0c9985fcef7b47
author: Diego Biurrun <diego@biurrun.de>
date: Fri Oct 24 23:12:22 EDT 2014

libdvdcss: Refactor error handling in dvdcss_open()

--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -217,9 +217,7 @@
         {
             print_error( dvdcss, "unknown decrypt method, please choose "
                                  "from 'title', 'key' or 'disc'" );
-            free( dvdcss->psz_device );
-            free( dvdcss );
-            return NULL;
+            goto error;
         }
     }
 
@@ -315,9 +313,7 @@
     i_ret = dvdcss_open_device( dvdcss );
     if( i_ret < 0 )
     {
-        free( dvdcss->psz_device );
-        free( dvdcss );
-        return NULL;
+        goto error;
     }
 
     dvdcss->b_scrambled = 1; /* Assume the worst */
@@ -524,6 +520,11 @@
     dvdcss->pf_seek( dvdcss, 0 );
 
     return dvdcss;
+
+error:
+    free( dvdcss->psz_device );
+    free( dvdcss );
+    return NULL;
 }
 
 /**