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)
|
extern int ZEXPORT unzClose (file)
|
||||||
unzFile file;
|
unzFile file;
|
||||||
{
|
{
|
||||||
unz_s* s;
|
unz_s* s = (unz_s*) file;
|
||||||
if (file==NULL)
|
if (!s)
|
||||||
return UNZ_PARAMERROR;
|
return UNZ_PARAMERROR;
|
||||||
s=(unz_s*)file;
|
|
||||||
|
|
||||||
if (s->pfile_in_zip_read!=NULL)
|
if (s->pfile_in_zip_read!=NULL)
|
||||||
unzCloseCurrentFile(file);
|
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 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
|
\S2{} Translations
|
||||||
|
|
||||||
\b Changed LANGFILE macro in LangFile.nsh
|
\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");
|
throw runtime_error("can't open file");
|
||||||
|
|
||||||
if (!fread(&igh, sizeof(IconGroupHeader), 1, f))
|
if (!fread(&igh, sizeof(IconGroupHeader), 1, f))
|
||||||
|
{
|
||||||
|
fclose(f);
|
||||||
throw runtime_error("unable to read header from file");
|
throw runtime_error("unable to read header from file");
|
||||||
|
}
|
||||||
|
|
||||||
FIX_ENDIAN_INT16_INPLACE(igh.wIsIcon);
|
FIX_ENDIAN_INT16_INPLACE(igh.wIsIcon);
|
||||||
FIX_ENDIAN_INT16_INPLACE(igh.wReserved);
|
FIX_ENDIAN_INT16_INPLACE(igh.wReserved);
|
||||||
FIX_ENDIAN_INT16_INPLACE(igh.wCount);
|
FIX_ENDIAN_INT16_INPLACE(igh.wCount);
|
||||||
|
|
||||||
if (igh.wIsIcon != 1 || igh.wReserved != 0)
|
if (igh.wIsIcon != 1 || igh.wReserved != 0)
|
||||||
|
{
|
||||||
|
fclose(f);
|
||||||
throw runtime_error("invalid icon file");
|
throw runtime_error("invalid icon file");
|
||||||
|
}
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
@ -89,6 +95,7 @@ IconGroup load_icon_file(const TCHAR* filename)
|
||||||
IconGroup result;
|
IconGroup result;
|
||||||
|
|
||||||
FILE *file = open_icon(filename, iconHeader);
|
FILE *file = open_icon(filename, iconHeader);
|
||||||
|
MANAGE_WITH(file, fclose);
|
||||||
|
|
||||||
for (WORD i = 0; i < iconHeader.wCount; i++)
|
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)
|
if (_fputts(text, fp) < 0)
|
||||||
{
|
{
|
||||||
|
fclose(fp);
|
||||||
ERROR_MSG(_T("!appendfile: error writing to \"%s\".\n"), file);
|
ERROR_MSG(_T("!appendfile: error writing to \"%s\".\n"), file);
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,20 +145,20 @@ int update_bitmap(CResourceEditor* re, WORD id, const TCHAR* filename, int width
|
||||||
dwSize -= 14;
|
dwSize -= 14;
|
||||||
|
|
||||||
unsigned char* bitmap = (unsigned char*)malloc(dwSize);
|
unsigned char* bitmap = (unsigned char*)malloc(dwSize);
|
||||||
if (!bitmap) throw bad_alloc();
|
if (!bitmap) {
|
||||||
|
|
||||||
fseek(f, 14, SEEK_SET);
|
|
||||||
if (fread(bitmap, 1, dwSize, f) != dwSize) {
|
|
||||||
fclose(f);
|
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);
|
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);
|
free(bitmap);
|
||||||
|
return retval;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -717,6 +717,7 @@ static bool GetDLLVersionUsingRE(const tstring& filepath, DWORD& high, DWORD & l
|
||||||
free(dll);
|
free(dll);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
fclose(fdll);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue