Skip to content

Commit ff6bc08

Browse files
committed
Remove pointless null check in operator delete
free() checks for NULL, no need to add another check.
1 parent 4e22295 commit ff6bc08

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

platform/mbed_retarget.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,15 +1045,11 @@ void *operator new[](std::size_t count, const std::nothrow_t& tag)
10451045

10461046
void operator delete(void *ptr)
10471047
{
1048-
if (ptr != NULL) {
1049-
free(ptr);
1050-
}
1048+
free(ptr);
10511049
}
10521050
void operator delete[](void *ptr)
10531051
{
1054-
if (ptr != NULL) {
1055-
free(ptr);
1056-
}
1052+
free(ptr);
10571053
}
10581054

10591055
/* @brief standard c library clock() function.

0 commit comments

Comments
 (0)