diff options
author | Damien George <damien.p.george@gmail.com> | 2014-10-09 16:54:03 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-10-09 16:54:03 +0100 |
commit | f0f964807eaf550e3107b22d51d8fdc905c77ffd (patch) | |
tree | 2791cbe24eb236443216962ef7b3456dc7eeb892 /py/lexerunix.c | |
parent | 7989b076376900ee6fb0ab7a86875844b5c179aa (diff) | |
parent | 9bf5f2857d2015e3d440feb03c102ed9730c8f4d (diff) | |
download | micropython-f0f964807eaf550e3107b22d51d8fdc905c77ffd.tar.gz micropython-f0f964807eaf550e3107b22d51d8fdc905c77ffd.zip |
Merge branch 'dhylands-lexer-crash'
Diffstat (limited to 'py/lexerunix.c')
-rw-r--r-- | py/lexerunix.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/py/lexerunix.c b/py/lexerunix.c index 9d669f2bfe..52eac9eda5 100644 --- a/py/lexerunix.c +++ b/py/lexerunix.c @@ -69,7 +69,10 @@ STATIC void file_buf_close(mp_lexer_file_buf_t *fb) { } mp_lexer_t *mp_lexer_new_from_file(const char *filename) { - mp_lexer_file_buf_t *fb = m_new_obj(mp_lexer_file_buf_t); + mp_lexer_file_buf_t *fb = m_new_obj_maybe(mp_lexer_file_buf_t); + if (fb == NULL) { + return NULL; + } fb->fd = open(filename, O_RDONLY); if (fb->fd < 0) { m_del_obj(mp_lexer_file_buf_t, fb); |