From 2c270d615318f5e68f8f438de7430f22b6c17eab Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 18 Oct 2007 22:17:46 +0000 Subject: [PATCH] Took care of disposal of burn_disc ovbject --- src/libisoburn.h | 26 ++++++++++++++++++-------- test/xorriso_timestamp.h | 2 +- test/xorrisoburn.c | 18 ++++++++++-------- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/libisoburn.h b/src/libisoburn.h index 00c2e8fd..02870d99 100644 --- a/src/libisoburn.h +++ b/src/libisoburn.h @@ -217,21 +217,31 @@ int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte, int flag); -/** Prepare a disc for writing the new session. - @param drive The target drive - @param disc A burn_disc suitable to pass to isoburn_disc_write(). +/** Create a disc object for writing the new session from the created or loaded + iso_volset which has been manipulated via libisofs, to the same media from + where the image was eventually loaded. This struct burn_disc is ready for + use by a subsequent call to isoburn_disc_write(). + After this asynchronous writing has ended and the drive is BURN_DRIVE_IDLE + again, the burn_disc object has to be disposed by burn_disc_free(). + @param drive The combined source and target drive, grabbed with + isoburn_drive_scan_and_grab(). . + @param disc Returns the newly created burn_disc object. @return <=0 error , 1 = success */ int isoburn_prepare_disc(struct burn_drive *d, struct burn_disc **disc, struct isoburn_source_opts *opts); -/** Prepare a disc for creating a new image from the contents of a previous - image volset plus the changes made by user. The generated burn_disc is - suitable to be written to any libburn drive. You shouldn't use the same - drive you're using as source. +/** Create a disc object for producing a new image from a previous image + plus the changes made by user. The generated burn_disc is suitable + to be written to any other libburn drive. You must not use the same drive + for writing as you are using here as source, because data will be + read from the source drive while the target drive gets written to. + The resulting burn_disc object has to be disposed when all its writing + is done and the drive is BURN_DRIVE_IDLE again after asynchronous + burn_disc_write(). @param d The source drive, grabbed with isoburn_drive_scan_and_grab(). - @param disc A burn_disc suitable to pass to burn_disc_write. + @param disc Returns the newly created burn_disc object. @return <=0 error , 1 = success */ int isoburn_prepare_new_image(struct burn_drive *d, struct burn_disc **disc, diff --git a/test/xorriso_timestamp.h b/test/xorriso_timestamp.h index 26676048..6dd918dc 100644 --- a/test/xorriso_timestamp.h +++ b/test/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2007.10.18.185731" +#define Xorriso_timestamP "2007.10.18.221756" diff --git a/test/xorrisoburn.c b/test/xorrisoburn.c index a11da370..21fbfb53 100644 --- a/test/xorrisoburn.c +++ b/test/xorrisoburn.c @@ -259,7 +259,7 @@ int Xorriso_write_growing(struct XorrisO *xorriso, int flag) struct isoburn_source_opts sopts; struct burn_drive_info *dinfo; struct burn_drive *drive; - struct burn_disc *disc; + struct burn_disc *disc= NULL; struct burn_write_opts *burn_options; ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, @@ -293,19 +293,19 @@ int Xorriso_write_growing(struct XorrisO *xorriso, int flag) Xorriso_process_msg_queues(xorriso,0); sprintf(xorriso->info_text,"Cannot prepare disc"); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); - return(0); + {ret= 0; goto ex;} } ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0); if(ret<=0) - return(ret); + goto ex; isoburn_disc_write(burn_options, disc); burn_write_opts_free(burn_options); ret= Xorriso_pacifier_loop(xorriso, drive, 0); if(ret<=0) - return(ret); + goto ex; ret= isoburn_activate_session(drive); Xorriso_process_msg_queues(xorriso,0); @@ -313,13 +313,15 @@ int Xorriso_write_growing(struct XorrisO *xorriso, int flag) sprintf(xorriso->info_text, "Could not write new set of volume descriptors"); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); - return(ret); + goto ex; } - /* >>> cleanup disc ? */ - + ret= 1; +ex:; + if(disc!=NULL) + burn_disc_free(disc); Xorriso_process_msg_queues(xorriso,0); - return(1); + return(ret); }