This commit is contained in:
Matt Woodrow 2008-12-15 00:48:54 -05:00
commit 5a5172be57

View File

@ -18,7 +18,6 @@ int main(int argc, char **argv)
{ {
void *handle; void *handle;
void **pVtable; void **pVtable;
handle = dlopen(argv[1], RTLD_NOW);
VOffset offsets; VOffset offsets;
char *params = NULL; char *params = NULL;
@ -30,6 +29,8 @@ int main(int argc, char **argv)
return -1; return -1;
} }
handle = dlopen(argv[1], RTLD_NOW);
if (handle == NULL) if (handle == NULL)
{ {
fprintf(stderr, "Failed to open server image, error [%s]\n", dlerror()); fprintf(stderr, "Failed to open server image, error [%s]\n", dlerror());
@ -41,6 +42,7 @@ int main(int argc, char **argv)
if (pVtable == NULL) if (pVtable == NULL)
{ {
fprintf(stderr, "Invalid vtable symbol \"%s\"\n", argv[2]); fprintf(stderr, "Invalid vtable symbol \"%s\"\n", argv[2]);
dlclose(handle);
return -1; return -1;
} }
@ -86,10 +88,12 @@ int main(int argc, char **argv)
printf("%s - Win: %i Linux : %i\n", argv[3], offsets.windows_offset, offsets.linux_offset); printf("%s - Win: %i Linux : %i\n", argv[3], offsets.windows_offset, offsets.linux_offset);
} }
dlclose(handle);
return 0; return 0;
} }
fprintf(stderr, "Failed to find function!"); fprintf(stderr, "Failed to find function!");
dlclose(handle);
return -1; return -1;
} }
@ -175,8 +179,6 @@ static bool FindVFunc(void *handle, void **vtable, const char* vtable_end, const
windows_offset = (overloads-location) + start_offset; windows_offset = (overloads-location) + start_offset;
dlclose(handle);
offsets->linux_offset = linux_offset - 2; offsets->linux_offset = linux_offset - 2;
offsets->windows_offset = windows_offset - 2; offsets->windows_offset = windows_offset - 2;