From 00a1607c8ca3f81d628e60aca40a3661ba4bfc37 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 14 Feb 2011 13:15:04 +0000 Subject: [PATCH] Closed memory leaks detected by valgrind --- libisoburn/trunk/xorriso/base_obj.c | 4 ++++ libisoburn/trunk/xorriso/filters.c | 3 +++ libisoburn/trunk/xorriso/parse_exec.c | 4 ++-- libisoburn/trunk/xorriso/write_run.c | 1 + libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libisoburn/trunk/xorriso/base_obj.c b/libisoburn/trunk/xorriso/base_obj.c index 2ad83e50..4ad8d53e 100644 --- a/libisoburn/trunk/xorriso/base_obj.c +++ b/libisoburn/trunk/xorriso/base_obj.c @@ -447,6 +447,10 @@ int Xorriso_destroy(struct XorrisO **xorriso, int flag) m= *xorriso; if(m==NULL) return(0); + + /* Give up drives and image to unref all connected xorriso objects */ + Xorriso_give_up_drive(m, 3); + if(m->in_charset!=NULL) free(m->in_charset); if(m->out_charset!=NULL) diff --git a/libisoburn/trunk/xorriso/filters.c b/libisoburn/trunk/xorriso/filters.c index e2031b87..335b2cb4 100644 --- a/libisoburn/trunk/xorriso/filters.c +++ b/libisoburn/trunk/xorriso/filters.c @@ -118,6 +118,8 @@ int Xorriso_extf_destroy(struct XorrisO *xorriso, struct Xorriso_extF **filter, if(cmd != NULL) { if(cmd->refcount > 0) return(0); + if(cmd->path != NULL) + free(cmd->path); if(cmd->suffix != NULL) free(cmd->suffix); if(cmd->argv != NULL) { @@ -128,6 +130,7 @@ int Xorriso_extf_destroy(struct XorrisO *xorriso, struct Xorriso_extF **filter, } if(cmd->name != NULL) free(cmd->name); + free((char *) cmd); } free((char *) *filter); *filter= NULL; diff --git a/libisoburn/trunk/xorriso/parse_exec.c b/libisoburn/trunk/xorriso/parse_exec.c index 08065a7f..bc3f1a2a 100644 --- a/libisoburn/trunk/xorriso/parse_exec.c +++ b/libisoburn/trunk/xorriso/parse_exec.c @@ -181,9 +181,9 @@ no_memory:; ret= 1; ex:; + if(patterns!=NULL) + free((char *) patterns); if(ret<=0) { - if(patterns!=NULL) - free((char *) patterns); Sfile_destroy_argv(&filec, &filev, 0); } else { *optc= filec; diff --git a/libisoburn/trunk/xorriso/write_run.c b/libisoburn/trunk/xorriso/write_run.c index 4dbceac0..57053f78 100644 --- a/libisoburn/trunk/xorriso/write_run.c +++ b/libisoburn/trunk/xorriso/write_run.c @@ -1215,6 +1215,7 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive, break; } } + iso_image_unref(image); return(1); } diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 5fa59bbd..9528cd27 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2011.02.12.172930" +#define Xorriso_timestamP "2011.02.14.090737"