Skip to content

Commit 26d4a6f

Browse files
committed
py/malloc: Remove unneeded code checking m_malloc return value.
m_malloc already checks for a failed allocation so there's no need to check for it in m_malloc0.
1 parent d7a52e1 commit 26d4a6f

1 file changed

Lines changed: 0 additions & 3 deletions

File tree

py/malloc.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,6 @@ void *m_malloc_with_finaliser(size_t num_bytes) {
117117

118118
void *m_malloc0(size_t num_bytes) {
119119
void *ptr = m_malloc(num_bytes);
120-
if (ptr == NULL && num_bytes != 0) {
121-
m_malloc_fail(num_bytes);
122-
}
123120
// If this config is set then the GC clears all memory, so we don't need to.
124121
#if !MICROPY_GC_CONSERVATIVE_CLEAR
125122
memset(ptr, 0, num_bytes);

0 commit comments

Comments
 (0)