From f06a3982ef25e1c482d60ea64cda0179b463d4e8 Mon Sep 17 00:00:00 2001 From: satbaby Date: Mon, 1 Feb 2010 22:21:32 +0000 Subject: [PATCH] fix possible Resource leak git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@249 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/driver/framebuffer.cpp | 1 + src/driver/pictureviewer/bmp.cpp | 1 + src/system/flashtool.cpp | 3 +++ 3 files changed, 5 insertions(+) diff --git a/src/driver/framebuffer.cpp b/src/driver/framebuffer.cpp index 0995a9fa7..476be5088 100644 --- a/src/driver/framebuffer.cpp +++ b/src/driver/framebuffer.cpp @@ -1187,6 +1187,7 @@ bool CFrameBuffer::loadPictureToMem(const std::string & filename, const uint16_t (height != ((header.height_hi << 8) | header.height_lo))) { printf("error while loading icon: %s - invalid resolution = %hux%hu\n", filename.c_str(), width, height); + close(lfd); return false; } diff --git a/src/driver/pictureviewer/bmp.cpp b/src/driver/pictureviewer/bmp.cpp index 6b9db9f0a..8c56bd379 100644 --- a/src/driver/pictureviewer/bmp.cpp +++ b/src/driver/pictureviewer/bmp.cpp @@ -99,6 +99,7 @@ int fh_bmp_load(const char *name,unsigned char **buffer,int* xp,int* yp) if(tbuffer==NULL) { printf("Error: malloc\n"); + close(fd); return (FH_ERROR_MALLOC); } for (i=0; igetText(LOCALE_FLASHUPDATE_FILEIS0BYTES); + close(fd1); return false; } @@ -187,6 +188,7 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra //g_Zapit->shutdown(); sleep(2); if(!erase(globalProgressEndErase)) { + close(fd1); return false; } @@ -263,6 +265,7 @@ bool CFlashTool::erase(int globalProgressEnd) { // TODO: localize error message ErrorMessage = "can't get mtd-info"; + close(fd); return false; }