Fixed minor MakeNSIS leaks (Bug #3474662)
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6309 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
a2fe9bec1b
commit
d3d637fab9
5 changed files with 21 additions and 11 deletions
|
@ -514,10 +514,9 @@ extern unzFile ZEXPORT unzOpen (path)
|
|||
extern int ZEXPORT unzClose (file)
|
||||
unzFile file;
|
||||
{
|
||||
unz_s* s;
|
||||
if (file==NULL)
|
||||
unz_s* s = (unz_s*) file;
|
||||
if (!s)
|
||||
return UNZ_PARAMERROR;
|
||||
s=(unz_s*)file;
|
||||
|
||||
if (s->pfile_in_zip_read!=NULL)
|
||||
unzCloseCurrentFile(file);
|
||||
|
|
|
@ -14,6 +14,8 @@ Released on ?, 2013
|
|||
|
||||
\b Reduced !include/!insertmacro recursion stack usage (\W{http://sourceforge.net/support/tracker.php?aid=3067954}{bug #3067954})
|
||||
|
||||
\b Fixed minor MakeNSIS leaks (\W{http://sourceforge.net/support/tracker.php?aid=3474662}{bug #3474662})
|
||||
|
||||
\S2{} Translations
|
||||
|
||||
\b Changed LANGFILE macro in LangFile.nsh
|
||||
|
|
|
@ -24,14 +24,20 @@ static FILE * open_icon(const TCHAR* filename, IconGroupHeader& igh)
|
|||
throw runtime_error("can't open file");
|
||||
|
||||
if (!fread(&igh, sizeof(IconGroupHeader), 1, f))
|
||||
{
|
||||
fclose(f);
|
||||
throw runtime_error("unable to read header from file");
|
||||
}
|
||||
|
||||
FIX_ENDIAN_INT16_INPLACE(igh.wIsIcon);
|
||||
FIX_ENDIAN_INT16_INPLACE(igh.wReserved);
|
||||
FIX_ENDIAN_INT16_INPLACE(igh.wCount);
|
||||
|
||||
if (igh.wIsIcon != 1 || igh.wReserved != 0)
|
||||
{
|
||||
fclose(f);
|
||||
throw runtime_error("invalid icon file");
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
@ -89,6 +95,7 @@ IconGroup load_icon_file(const TCHAR* filename)
|
|||
IconGroup result;
|
||||
|
||||
FILE *file = open_icon(filename, iconHeader);
|
||||
MANAGE_WITH(file, fclose);
|
||||
|
||||
for (WORD i = 0; i < iconHeader.wCount; i++)
|
||||
{
|
||||
|
|
|
@ -1390,6 +1390,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
|
||||
if (_fputts(text, fp) < 0)
|
||||
{
|
||||
fclose(fp);
|
||||
ERROR_MSG(_T("!appendfile: error writing to \"%s\".\n"), file);
|
||||
return PS_ERROR;
|
||||
}
|
||||
|
|
|
@ -145,20 +145,20 @@ int update_bitmap(CResourceEditor* re, WORD id, const TCHAR* filename, int width
|
|||
dwSize -= 14;
|
||||
|
||||
unsigned char* bitmap = (unsigned char*)malloc(dwSize);
|
||||
if (!bitmap) throw bad_alloc();
|
||||
|
||||
fseek(f, 14, SEEK_SET);
|
||||
if (fread(bitmap, 1, dwSize, f) != dwSize) {
|
||||
if (!bitmap) {
|
||||
fclose(f);
|
||||
return -2;
|
||||
throw bad_alloc();
|
||||
}
|
||||
|
||||
bool gotbmdata = !fseek(f, 14, SEEK_SET) && dwSize == fread(bitmap, 1, dwSize, f);
|
||||
int retval = gotbmdata ? 0 : -2;
|
||||
fclose(f);
|
||||
|
||||
re->UpdateResource(RT_BITMAP, id, NSIS_DEFAULT_LANG, bitmap, dwSize);
|
||||
if (gotbmdata)
|
||||
re->UpdateResource(RT_BITMAP, id, NSIS_DEFAULT_LANG, bitmap, dwSize);
|
||||
|
||||
free(bitmap);
|
||||
|
||||
return 0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
|
@ -717,6 +717,7 @@ static bool GetDLLVersionUsingRE(const tstring& filepath, DWORD& high, DWORD & l
|
|||
free(dll);
|
||||
return 0;
|
||||
}
|
||||
fclose(fdll);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue