diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-02-13 13:25:58 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-02-13 13:25:58 +0100 |
| commit | e7f0c8cbe1963ab7b223f23729a282a7f95ee14f (patch) | |
| tree | dbbbf9209e125f9d55291f7415016f2b5b7da4e0 /src | |
| parent | 9c8b663d5bc1f30717aa4d87cc63d1c9ebfa1c8e (diff) | |
| download | box64-e7f0c8cbe1963ab7b223f23729a282a7f95ee14f.tar.gz box64-e7f0c8cbe1963ab7b223f23729a282a7f95ee14f.zip | |
Fixed a small warning
Diffstat (limited to 'src')
| -rwxr-xr-x | src/wrapped/wrappedlibc.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index 2d444efd..0dfe617d 100755 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -2569,9 +2569,19 @@ EXPORT int my_mprotect(x64emu_t* emu, void *addr, unsigned long len, int prot) return ret; } +typedef struct mallinfo (*mallinfo_fnc)(void); EXPORT void* my_mallinfo(x64emu_t* emu, void* p) { - *(struct mallinfo*)p = mallinfo(); + static mallinfo_fnc f = NULL; + static int inited = 0; + if(!inited) { + inited = 1; + f = (mallinfo_fnc)dlsym(my_lib->w.lib, "mallinfo"); + } + if(f) + *(struct mallinfo*)p=f(); + else + memset(p, 0, sizeof(struct mallinfo)); return p; } |