[libdvdcss-devel] libdvdcss: Refactor error handling in dvdcss_open()
Diego Biurrun
git at videolan.org
Fri Oct 31 11:43:44 CET 2014
libdvdcss | branch: master | Diego Biurrun <diego at biurrun.de> | Sat Oct 25 03:12:22 2014 +0200| [001afc48ac34b343c4b7fee858856bf3df540cdf] | committer: Diego Biurrun
libdvdcss: Refactor error handling in dvdcss_open()
> http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=001afc48ac34b343c4b7fee858856bf3df540cdf
---
src/libdvdcss.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index a602050..b03dbfd 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -217,9 +217,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
{
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 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
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 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
dvdcss->pf_seek( dvdcss, 0 );
return dvdcss;
+
+error:
+ free( dvdcss->psz_device );
+ free( dvdcss );
+ return NULL;
}
/**
More information about the libdvdcss-devel
mailing list