Skip to content

Commit aec1f8d

Browse files
committed
Ignore error of os_munmap() when size equals 0
Fixes: #63 Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 7b28d9d commit aec1f8d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/provider/provider_os_memory.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ static umf_result_t os_free(void *provider, void *ptr, size_t size) {
337337

338338
errno = 0;
339339
int ret = os_munmap(ptr, size);
340-
if (ret) {
340+
// ignore error when size == 0
341+
if (ret && (size > 0)) {
341342
os_store_last_native_error(UMF_OS_RESULT_ERROR_FREE_FAILED, errno);
342343
if (os_config->traces) {
343344
perror("memory deallocation failed");

0 commit comments

Comments
 (0)