[vlc-commits] atmo: fix memory leaks.

Rémi Duraffort git at videolan.org
Wed Aug 29 19:27:03 CEST 2012


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Aug 29 19:12:45 2012 +0200| [40f657d50e2acdee338a0a49145408cc13b8b5ea] | committer: Rémi Duraffort

atmo: fix memory leaks.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=40f657d50e2acdee338a0a49145408cc13b8b5ea
---

 modules/video_filter/atmo/AtmoTools.cpp          |    1 +
 modules/video_filter/atmo/AtmoZoneDefinition.cpp |    3 +++
 2 files changed, 4 insertions(+)

diff --git a/modules/video_filter/atmo/AtmoTools.cpp b/modules/video_filter/atmo/AtmoTools.cpp
index 45dfca6..6775351 100644
--- a/modules/video_filter/atmo/AtmoTools.cpp
+++ b/modules/video_filter/atmo/AtmoTools.cpp
@@ -541,6 +541,7 @@ void CAtmoTools::SaveBitmap(HDC hdc,HBITMAP hBmp,char *fileName) {
      fwrite(&bmpInfo.bmiHeader,sizeof(BITMAPINFOHEADER),1,fp);
      fwrite(pBuf,bmpInfo.bmiHeader.biSizeImage,1,fp);
      fclose(fp);
+     free(pBuf);
 }
 
 
diff --git a/modules/video_filter/atmo/AtmoZoneDefinition.cpp b/modules/video_filter/atmo/AtmoZoneDefinition.cpp
index 997884b..f5bfef3 100644
--- a/modules/video_filter/atmo/AtmoZoneDefinition.cpp
+++ b/modules/video_filter/atmo/AtmoZoneDefinition.cpp
@@ -134,6 +134,7 @@ void CAtmoZoneDefinition::SaveZoneBitmap(char *fileName)
      fwrite(&bmpInfo.bmiHeader,sizeof(BITMAPINFOHEADER),1,fp);
      fwrite(pBuf,bmpInfo.bmiHeader.biSizeImage,1,fp);
      fclose(fp);
+     free(pBuf);
 }
 
 void CAtmoZoneDefinition::SaveWeightBitmap(char *fileName,int *weight)
@@ -179,6 +180,7 @@ void CAtmoZoneDefinition::SaveWeightBitmap(char *fileName,int *weight)
      fwrite(&bmpInfo.bmiHeader,sizeof(BITMAPINFOHEADER),1,fp);
      fwrite(pBuf,bmpInfo.bmiHeader.biSizeImage,1,fp);
      fclose(fp);
+     free(pBuf);
 }
 
 
@@ -252,6 +254,7 @@ int CAtmoZoneDefinition::LoadGradientFromBitmap(char *pszBitmap)
     unsigned char *pixelBuffer = (unsigned char *)malloc(imageSize);
     if(fread(pixelBuffer,imageSize,1,bmp) != 1)
     {
+        free(pixelBuffer);
         fclose(bmp);
         return ATMO_LOAD_GRADIENT_FAILED_SIZE;
     }



More information about the vlc-commits mailing list