From cd7d33bf0481069ca138562f18a23706a45002ea Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Sun, 14 Oct 2012 22:22:56 +0200 Subject: [PATCH] FIX: call libewf_handle_initialize() before each libewf_handle_open() --- src/ewf.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/ewf.c b/src/ewf.c index e23ee95c..591a253d 100644 --- a/src/ewf.c +++ b/src/ewf.c @@ -134,19 +134,6 @@ disk_t *fewf_init(const char *device, const int mode) free(data); return NULL; } - if( libewf_handle_initialize( - &( data->handle ), - NULL ) != 1 ) - { - log_error("libewf_handle_initialize failed\n"); - - libewf_glob_free( - filenames, - num_files, - NULL ); - free(data); - return NULL; - } #elif defined( HAVE_GLOB_H ) { globbuf.gl_offs = 0; @@ -176,6 +163,19 @@ disk_t *fewf_init(const char *device, const int mode) if((mode&TESTDISK_O_RDWR)==TESTDISK_O_RDWR) { #if defined( HAVE_LIBEWF_V2_API ) + if( libewf_handle_initialize( + &( data->handle ), + NULL ) != 1 ) + { + log_error("libewf_handle_initialize failed\n"); + + libewf_glob_free( + filenames, + num_files, + NULL ); + free(data); + return NULL; + } if( libewf_handle_open( data->handle, filenames, @@ -197,6 +197,19 @@ disk_t *fewf_init(const char *device, const int mode) { data->mode&=~TESTDISK_O_RDWR; #if defined( HAVE_LIBEWF_V2_API ) + if( libewf_handle_initialize( + &( data->handle ), + NULL ) != 1 ) + { + log_error("libewf_handle_initialize failed\n"); + + libewf_glob_free( + filenames, + num_files, + NULL ); + free(data); + return NULL; + } if( libewf_handle_open( data->handle, filenames,