syoyo / tinyobjloader-c

Header only tiny wavefront .obj loader in pure C99
412 stars 60 forks source link

Memory leak in tinyobj_parse_and_index_mtl_file #49

Closed Snigelson closed 1 year ago

Snigelson commented 2 years ago

Memory is allocates for line_infos by get_line_infos, but the memory is never free'd.

Adding TINYOBJ_FREE(line_infos); at the end if the function solves this.

syoyo commented 2 years ago

line_infos are freed at here: https://github.com/syoyo/tinyobjloader-c/blob/574390baed2a42705850392d0c75c09f8cc980bd/tinyobj_loader_c.h#L1402

but may be not free'ed in tinyobj_parse_and_index_mtl_file: https://github.com/syoyo/tinyobjloader-c/blob/574390baed2a42705850392d0c75c09f8cc980bd/tinyobj_loader_c.h#L824

You can send us PR!

syoyo commented 1 year ago

Closed via #54