summaryrefslogtreecommitdiffstatshomepage
path: root/py/lexerstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/lexerstr.c')
-rw-r--r--py/lexerstr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/py/lexerstr.c b/py/lexerstr.c
index a919dc7e14..a1f7ce41d0 100644
--- a/py/lexerstr.c
+++ b/py/lexerstr.c
@@ -52,7 +52,10 @@ STATIC void str_buf_free(mp_lexer_str_buf_t *sb) {
}
mp_lexer_t *mp_lexer_new_from_str_len(qstr src_name, const char *str, mp_uint_t len, mp_uint_t free_len) {
- mp_lexer_str_buf_t *sb = m_new_obj(mp_lexer_str_buf_t);
+ mp_lexer_str_buf_t *sb = m_new_obj_maybe(mp_lexer_str_buf_t);
+ if (sb == NULL) {
+ return NULL;
+ }
sb->free_len = free_len;
sb->src_beg = str;
sb->src_cur = str;