Skip to content

Commit

Permalink
py/malloc: Remove unneeded code checking m_malloc return value.
Browse files Browse the repository at this point in the history
m_malloc already checks for a failed allocation so there's no need to check
for it in m_malloc0.
  • Loading branch information
dpgeorge committed Dec 20, 2017
1 parent d7a52e1 commit 26d4a6f
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions py/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ void *m_malloc_with_finaliser(size_t num_bytes) {

void *m_malloc0(size_t num_bytes) {
void *ptr = m_malloc(num_bytes);
if (ptr == NULL && num_bytes != 0) {
m_malloc_fail(num_bytes);
}
// If this config is set then the GC clears all memory, so we don't need to.
#if !MICROPY_GC_CONSERVATIVE_CLEAR
memset(ptr, 0, num_bytes);
Expand Down

0 comments on commit 26d4a6f

Please sign in to comment.