Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FreeImage memleaks #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Common/UtilNPP/ImageIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ namespace npp
// swap the user given image with our result image, effecively
// moving our newly loaded image data into the user provided shell
oImage.swap(rImage);

// unloads the image loaded by FreeImage_Load
FreeImage_Unload(pBitmap);
}

// Save an gray-scale image to disk.
Expand All @@ -122,6 +125,9 @@ namespace npp
bool bSuccess;
bSuccess = FreeImage_Save(FIF_PGM, pResultBitmap, rFileName.c_str(), 0) == TRUE;
NPP_ASSERT_MSG(bSuccess, "Failed to save result image.");

// unloads the image loaded by FreeImage_Allocate
FreeImage_Unload(pBitmap);
}

// Load a gray-scale image from disk.
Expand Down