From adff1dd16bd3355c23295871771ad4b9e5e7d45e Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 22 Mar 2009 09:02:21 +0000 Subject: [PATCH] Stuffed memory leaks on -commit and loading of El Torito records --- xorriso/xorriso.c | 3 +++ xorriso/xorriso_timestamp.h | 2 +- xorriso/xorrisoburn.c | 11 +++++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/xorriso/xorriso.c b/xorriso/xorriso.c index a5ef67c2..b886c739 100644 --- a/xorriso/xorriso.c +++ b/xorriso/xorriso.c @@ -3199,6 +3199,7 @@ int Exclusions_destroy(struct ExclusionS **o, int flag) regfree((regex_t *) s->text); Xorriso_lst_destroy(&s, 0); } + free((char *) *o); (*o)= NULL; return(1); } @@ -4149,7 +4150,9 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->problem_status= 0; m->problem_status_text[0]= 0; m->errfile_log[0]= 0; + m->errfile_mode= 0; m->errfile_fp= NULL; + m->img_read_error_mode= 2; /* abort faulty image reading with FATAL */ m->extract_error_mode= 1; /* keep extracted files after read error */ strcpy(m->return_with_text, "SORRY"); diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 2f481d14..0e7441f0 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2009.03.20.193334" +#define Xorriso_timestamP "2009.03.22.090232" diff --git a/xorriso/xorrisoburn.c b/xorriso/xorrisoburn.c index 3192fe7b..87367115 100644 --- a/xorriso/xorrisoburn.c +++ b/xorriso/xorrisoburn.c @@ -457,6 +457,7 @@ int Xorriso_record_boot_info(struct XorrisO *xorriso, int flag) return(0); ret= iso_image_get_boot_image(image, &bootimg, &bootimg_node, &bootcat_node); + iso_image_unref(image); /* release obtained reference */ if(ret != 1) return(0); if(bootimg_node != NULL) @@ -830,9 +831,9 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag) "on attempt to give up drive", 0); if(!in_is_out_too) { - if(drive!=NULL && !in_is_out_too) + if(drive!=NULL) isoburn_drive_release(drive,!!(flag&4)); - if(dinfo!=NULL && !in_is_out_too) + if(dinfo!=NULL) burn_drive_info_free(dinfo); } xorriso->in_drive_handle= NULL; @@ -1472,6 +1473,8 @@ ex:; } if(disc!=NULL) burn_disc_free(disc); + if(image != NULL) + iso_image_unref(image); isoburn_igopt_destroy(&sopts, 0); Xorriso_process_msg_queues(xorriso,0); return(ret); @@ -4121,7 +4124,7 @@ no_boot:; /* Using the nodes with extreme care . They might be deleted meanwhile. */ ret= iso_image_get_boot_image(image, &bootimg, &bootimg_node, &bootcat_node); - iso_image_unref(image); + iso_image_unref(image); /* release obtained reference */ image= NULL; if(ret != 1) goto no_boot; @@ -5111,7 +5114,7 @@ int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter, off_t boss_mem, char *sfe= NULL, *sub_path= NULL; off_t mem; IsoNode **node_array= NULL; - int node_count, node_idx; + int node_count= 0, node_idx; /* Avoiding large local memory objects in order to save stack space */ sfe= malloc(5*SfileadrL);