Commit 2b41fd81 authored by Manuel Günther's avatar Manuel Günther
Browse files

Fixed memory leak in jpeg loading.

parent f1574a5e
......@@ -79,6 +79,9 @@ static void im_peek(const std::string& path, bob::io::base::array::typeinfo& inf
if( cinfo.output_components != 1 && cinfo.output_components != 3)
{
// 6. clean up
jpeg_destroy_decompress(&cinfo);
boost::format m("unsupported number of planes (%d) when reading file. Image depth must be 1 or 3.");
m % cinfo.output_components;
throw std::runtime_error(m.str());
......@@ -100,6 +103,8 @@ static void im_peek(const std::string& path, bob::io::base::array::typeinfo& inf
}
info.update_strides();
// 6. clean up
jpeg_destroy_decompress(&cinfo);
}
template <typename T> static
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment