Closed a small memory leak

This commit is contained in:
Thomas Schmitt 2008-01-15 20:41:56 +00:00
parent a3e6d565dd
commit 8b98e34ff6
6 changed files with 27 additions and 15 deletions

View File

@ -119,11 +119,19 @@ int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag)
} }
int Xorriso_shutdown_libraries(struct XorrisO *xorriso, int flag) /* @param flag bit0= global shutdown of libraries */
int Xorriso_detach_libraries(struct XorrisO *xorriso, int flag)
{ {
Xorriso_give_up_drive(xorriso, 3);
if(xorriso->in_volset_handle!=NULL) { /* standalone image */
iso_image_unref((IsoImage *) xorriso->in_volset_handle);
xorriso->in_volset_handle= NULL;
}
if(flag&1) {
if(xorriso->libs_are_started==0) if(xorriso->libs_are_started==0)
return(0); return(0);
isoburn_finish(); isoburn_finish();
}
return(1); return(1);
} }

View File

@ -19,7 +19,8 @@ struct FindjoB;
int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag); int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag);
int Xorriso_shutdown_libraries(struct XorrisO *xorriso, int flag); /* @param flag bit0= global shutdown of libraries */
int Xorriso_detach_libraries(struct XorrisO *xorriso, int flag);
int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag); int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag);

View File

@ -2957,7 +2957,7 @@ int Xorriso_destroy_re(struct XorrisO *m, int flag)
} }
/* @param flag bit0= shutdown libraries */ /* @param flag bit0= global shutdown of libraries */
int Xorriso_destroy(struct XorrisO **xorriso, int flag) int Xorriso_destroy(struct XorrisO **xorriso, int flag)
{ {
struct XorrisO *m; struct XorrisO *m;
@ -2965,10 +2965,8 @@ int Xorriso_destroy(struct XorrisO **xorriso, int flag)
m= *xorriso; m= *xorriso;
if(m==NULL) if(m==NULL)
return(0); return(0);
Xorriso_give_up_drive(m, 3);
Xorriso_destroy_re(m,0); Xorriso_destroy_re(m,0);
if(flag&1) Xorriso_detach_libraries(m, flag&1);
Xorriso_shutdown_libraries(m, 0);
free((char *) m); free((char *) m);
*xorriso= NULL; *xorriso= NULL;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.01.15.174409" #define Xorriso_timestamP "2008.01.15.204057"

View File

@ -101,11 +101,15 @@ int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag)
} }
int Xorriso_shutdown_libraries(struct XorrisO *xorriso, int flag) /* @param flag bit0= global shutdown of libraries */
int Xorriso_detach_libraries(struct XorrisO *xorriso, int flag)
{ {
Xorriso_give_up_drive(xorriso, 3);
if(flag&1) {
if(xorriso->libs_are_started==0) if(xorriso->libs_are_started==0)
return(0); return(0);
isoburn_finish(); isoburn_finish();
}
return(1); return(1);
} }

View File

@ -19,7 +19,8 @@ struct FindjoB;
int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag); int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag);
int Xorriso_shutdown_libraries(struct XorrisO *xorriso, int flag); /* @param flag bit0= global shutdown of libraries */
int Xorriso_detach_libraries(struct XorrisO *xorriso, int flag);
int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag); int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag);