craigsapp / humlib

Humdrum data parsing library in C++
http://humlib.humdrum.org
BSD 2-Clause "Simplified" License
31 stars 8 forks source link

Eliminates execution path with using uninitialised pointer #21

Closed valeriyvan closed 4 years ago

craigsapp commented 4 years ago

It seems my commentary on this commit got lost :-(

The code was correct, but difficult for an automatic parser to figure out. I adjusted the pull request in commit https://github.com/craigsapp/humlib/commit/3b56ab496576633caf750d79e45828c5745a5972.

I changed the allocation of a token to instead be a test case for a null pointer; otherwise, there will be a memory leak created for cases where the token is allocated but not stored or freed.

Also note that humlib code is tab indented :-)