Diego Biurrun
2014-10-31 10:43:44 UTC
libdvdcss | branch: master | Diego Biurrun <***@biurrun.de> | Sat Oct 25 03:12:22 2014 +0200| [001afc48ac34b343c4b7fee858856bf3df540cdf] | committer: Diego Biurrun
libdvdcss: Refactor error handling in dvdcss_open()
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;
}
/**
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;
}
/**