Skip to content

Commit caede57

Browse files
committed
Avoided intercepting free when called with a nullptr
1 parent 05abc6e commit caede57

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/rtcheck.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,11 @@ INTERCEPTOR(void*, valloc, size_t size)
327327

328328
INTERCEPTOR(void, free, void* ptr)
329329
{
330-
log_function_if_realtime_context_and_enabled (rtc::check_flags::free, __func__);
331-
INTERCEPT_FUNCTION(void, free, void*);
330+
if (ptr != nullptr)
331+
{
332+
log_function_if_realtime_context_and_enabled (rtc::check_flags::free, __func__);
333+
INTERCEPT_FUNCTION(void, free, void*);
334+
}
332335

333336
return REAL(free)(ptr);
334337
}

0 commit comments

Comments
 (0)