py: Add further checks for failed malloc in lexer init functions.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user