rogersce / cnpy

library to read/write .npy and .npz files in C/C++
MIT License
1.34k stars 301 forks source link

cnpy.cpp: fix memory leak in parsing shape field #10

Closed rjw57 closed 9 years ago

rjw57 commented 9 years ago

The shape array created at cnpy.cpp:80 was never delete-ed. Add a delete[] call at cnpy.cpp:136 to address this. A better solution may be to pass a std::vector<> reference to parse_npy_header().

rogersce commented 9 years ago

Hey Rich, thanks for spotting this and letting me know! I'll update memory management soon (somone else submitted a PR a while ago for this that I should merge).