Skip to content

Commit 1f2ca65

Browse files
committed
Get size from tracking provider in proxy_free()
Fixes: #475 Signed-off-by: Lukasz Dorau <[email protected]>
1 parent a85037f commit 1f2ca65

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/pool/pool_proxy.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <assert.h>
1414

1515
#include "base_alloc_global.h"
16+
#include "provider/provider_tracking.h"
1617
#include "utils_common.h"
1718

1819
static __TLS umf_result_t TLS_last_allocation_error;
@@ -91,9 +92,19 @@ static void *proxy_realloc(void *pool, void *ptr, size_t size) {
9192

9293
static umf_result_t proxy_free(void *pool, void *ptr) {
9394
assert(pool);
95+
size_t size = 0;
9496

9597
struct proxy_memory_pool *hPool = (struct proxy_memory_pool *)pool;
96-
return umfMemoryProviderFree(hPool->hProvider, ptr, 0);
98+
99+
if (ptr) {
100+
umf_alloc_info_t allocInfo = {0};
101+
umf_result_t umf_result = umfMemoryTrackerGetAllocInfo(ptr, &allocInfo);
102+
if (umf_result == UMF_RESULT_SUCCESS) {
103+
size = allocInfo.baseSize;
104+
}
105+
}
106+
107+
return umfMemoryProviderFree(hPool->hProvider, ptr, size);
97108
}
98109

99110
static size_t proxy_malloc_usable_size(void *pool, void *ptr) {

0 commit comments

Comments
 (0)