diff options
| -rwxr-xr-x | src/box64context.c | 4 | ||||
| -rwxr-xr-x | src/elfs/elfloader.c | 2 | ||||
| -rwxr-xr-x | src/librarian/library.c | 9 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/box64context.c b/src/box64context.c index f6ca346a..1fd4588a 100755 --- a/src/box64context.c +++ b/src/box64context.c @@ -359,12 +359,12 @@ void RemoveElfHeader(box64context_t* ctx, elfheader_t* head) { if(GetTLSBase(head)) { // should remove the tls info int tlsbase = GetTLSBase(head); - if(tlsbase == -ctx->tlssize) { + /*if(tlsbase == -ctx->tlssize) { // not really correct, but will do for now ctx->tlssize -= GetTLSSize(head); if(!(++ctx->sel_serial)) ++ctx->sel_serial; - } + }*/ } for(int i=0; i<ctx->elfsize; ++i) if(ctx->elfs[i] == head) { diff --git a/src/elfs/elfloader.c b/src/elfs/elfloader.c index 10db2c86..225f2058 100755 --- a/src/elfs/elfloader.c +++ b/src/elfs/elfloader.c @@ -1347,8 +1347,6 @@ void RunElfFini(elfheader_t* h, x64emu_t *emu) RunFunctionWithEmu(emu, 0, p, 0); } h->init_done = 0; // can be re-inited again... - for(int i=0; i<h->needed->size; ++i) - DecRefCount(&h->needed->libs[i], emu); return; } diff --git a/src/librarian/library.c b/src/librarian/library.c index 085d954d..9f852408 100755 --- a/src/librarian/library.c +++ b/src/librarian/library.c @@ -1079,8 +1079,9 @@ void IncRefCount(library_t* lib, x64emu_t* emu) case LIB_WRAPPED: ++lib->w.refcnt; if(lib->w.needed) - for(int i=0; i<lib->w.needed->size; ++i) + for(int i=0; i<lib->w.needed->size; ++i) { IncRefCount(lib->w.needed->libs[i], emu); + } break; case LIB_EMULATED: ++lib->e.elf->refcnt; @@ -1102,7 +1103,8 @@ int DecRefCount(library_t** lib, x64emu_t* emu) switch ((*lib)->type) { case LIB_WRAPPED: needed = (*lib)->w.needed; - if(!(ret=--(*lib)->w.refcnt)) { + ret=--(*lib)->w.refcnt; + if(!ret) { needed = copy_neededlib(needed); freed=1; Free1Library(lib, emu); @@ -1110,7 +1112,8 @@ int DecRefCount(library_t** lib, x64emu_t* emu) break; case LIB_EMULATED: needed = (*lib)->e.elf->needed; - if(!(ret=--(*lib)->e.elf->refcnt)) { + ret=--(*lib)->e.elf->refcnt; + if(!ret) { needed = copy_neededlib(needed); freed=1; removeLinkMapLib(*lib); |