From cb42e2fcd9d00c76a391a9abb58ece32bd75d4ac Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 15 Oct 2006 18:49:30 +0000 Subject: [PATCH] Hunting a malloc/free memory problem --- cdrskin/compile_cdrskin.sh | 29 +++++++++++++++++++++++++++++ test/dewav.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/cdrskin/compile_cdrskin.sh b/cdrskin/compile_cdrskin.sh index 076bb12..6830144 100755 --- a/cdrskin/compile_cdrskin.sh +++ b/cdrskin/compile_cdrskin.sh @@ -15,12 +15,16 @@ warn_opts="-Wall" fifo_source="cdrskin/cdrfifo.c" compile_cdrskin=1 compile_cdrfifo=0 +compile_dewav=0 for i in "$@" do if test "$i" = "-compile_cdrfifo" then compile_cdrfifo=1 + elif test "$i" = "-compile_dewav" + then + compile_dewav=1 elif test "$i" = "-cvs_A60220" then libvers="-DCdrskin_libburn_cvs_A60220_tS" @@ -65,6 +69,7 @@ do echo "cdrskin/compile_cdrskin.sh : to be executed within ./cdrskin-0.1.3.0.2.ts" echo "Options:" echo " -compile_cdrfifo compile program cdrskin/cdrfifo." + echo " -compile_dewav compile program test/dewav without libburn." echo " -cvs_A60220 set macro to match libburn-CVS of 20 Feb 2006." echo " -libburn_0_2_2 set macro to match libburn-0.2.2" echo " -libburn_0_2_3 set macro to match current libburn-SVN." @@ -159,6 +164,30 @@ then fi fi +if test "$compile_dewav" = 1 +then + echo "compiling program test/dewav.c -DDewav_without_libburN $static_opts $debug_opts" + cc $static_opts $debug_opts \ + -DDewav_without_libburN \ + -o test/dewav \ + test/dewav.c \ + libburn/libdax_audioxtr.o \ + libburn/libdax_msgs.o \ + \ + -lpthread + + ret=$? + if test "$ret" = 0 + then + dummy=dummy + else + echo >&2 + echo "+++ FATAL : Compilation of test/dewav failed" >&2 + echo >&2 + exit 2 + fi +fi + if test "$do_strip" = 1 then echo "stripping result cdrskin/cdrskin" diff --git a/test/dewav.c b/test/dewav.c index 9178f0c..38bb254 100644 --- a/test/dewav.c +++ b/test/dewav.c @@ -15,10 +15,19 @@ #include #include +#ifdef Dewav_without_libburN + +#include "../libburn/libdax_msgs.h" +struct libdax_msgs *libdax_messenger= NULL; + +#else /* Dewav_without_libburN */ /* The API of libburn */ #include "../libburn/libburn.h" +#endif /* ! Dewav_without_libburN */ + + /* The API extension for .wav extraction */ #include "../libburn/libdax_audioxtr.h" @@ -75,6 +84,19 @@ help:; in_path= "-"; +#ifdef Dewav_without_libburN + + ret= libdax_msgs_new(&libdax_messenger,0); + if(ret<=0) { + fprintf(stderr,"Failed to create libdax_messenger object.\n"); + exit(3); + } + libdax_msgs_set_severities(libdax_messenger, LIBDAX_MSGS_SEV_NEVER, + LIBDAX_MSGS_SEV_NOTE, "", 0); + fprintf(stderr, "dewav on libdax\n"); + +#else /* Dewav_without_libburN */ + /* Initialize libburn and set up messaging system */ if(burn_initialize() == 0) { fprintf(stderr,"Failed to initialize libburn.\n"); @@ -82,6 +104,9 @@ help:; } /* Print messages of severity NOTE or more directly to stderr */ burn_msgs_set_severities("NEVER", "NOTE", ""); + fprintf(stderr, "dewav on libburn\n"); + +#endif /* ! Dewav_without_libburN */ /* Open audio source and create extractor object */ @@ -134,6 +159,16 @@ help:; if(out_fd>2) close(out_fd); libdax_audioxtr_destroy(&xtr, 0); + +#ifdef Dewav_without_libburN + + libdax_msgs_destroy(&libdax_messenger,0); + +#else /* Dewav_without_libburN */ + burn_finish(); + +#endif /* ! Dewav_without_libburN */ + exit(0); }