Made improvements about pattern matching .., closed small memory leaks

This commit is contained in:
2008-01-15 17:45:08 +00:00
parent ebadf5dca1
commit a3e6d565dd
8 changed files with 65 additions and 10 deletions

View File

@ -2957,6 +2957,7 @@ int Xorriso_destroy_re(struct XorrisO *m, int flag)
}
/* @param flag bit0= shutdown libraries */
int Xorriso_destroy(struct XorrisO **xorriso, int flag)
{
struct XorrisO *m;
@ -2964,7 +2965,10 @@ int Xorriso_destroy(struct XorrisO **xorriso, int flag)
m= *xorriso;
if(m==NULL)
return(0);
Xorriso_give_up_drive(m, 3);
Xorriso_destroy_re(m,0);
if(flag&1)
Xorriso_shutdown_libraries(m, 0);
free((char *) m);
*xorriso= NULL;
@ -3450,7 +3454,7 @@ int Xorriso_prepare_regex(struct XorrisO *xorriso, char *adr, int flag)
int l,ret,i,count,bonked= 0,is_constant,is_still_relative= 0;
char *cpt,*npt,adr_part[2*SfileadrL],absolute_adr[2*SfileadrL],*adr_start,*wd;
if(flag&2)
if(flag&4)
wd= xorriso->wdx;
else
wd= xorriso->wdi;
@ -3535,11 +3539,12 @@ no_regex_available:;
if(adr_part[0]==0)
goto next_adr_part;
if(adr_part[0]=='.' && adr_part[1]==0 && count>1)
if(adr_part[0]=='.' && adr_part[1]==0 &&
(xorriso->re_fill>0 || i<count-1))
goto next_adr_part;
if(adr_part[0]=='.' && adr_part[1]=='.' && adr_part[2]==0) {
/* delete previous part */
if(xorriso->re_fill<=0) {
if(xorriso->re_fill<=1) {
bonked= 1;
goto next_adr_part;
}
@ -8923,7 +8928,7 @@ end_sucessfully:;
if(xorriso->volset_change_pending)
Xorriso_option_end(xorriso, 0);
Xorriso_process_msg_queues(xorriso, 0);
Xorriso_destroy(&xorriso,0);
Xorriso_destroy(&xorriso,1);
exit(0);
}