Revolved Deallocating a deallocated pointer: buf warning in archive.cpp.
This commit is contained in:
parent
ce03bf18e7
commit
9eaad6e14d
|
@ -181,7 +181,7 @@ protected:
|
|||
public:
|
||||
|
||||
explicit InStream()
|
||||
: refCount(0)
|
||||
: refCount(0), size(0)
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -374,17 +374,21 @@ void initArchiveSystem()
|
|||
}
|
||||
}
|
||||
|
||||
static std::string wstringFromPROPVARIANT(BSTR bstr, bool& success) {
|
||||
static std::string wstringFromPROPVARIANT(BSTR bstr, bool& success)
|
||||
{
|
||||
std::string strret;
|
||||
std::wstring tempfname = bstr;
|
||||
int buflen = tempfname.size()*2;
|
||||
char* buf = new char[buflen];
|
||||
int ret = WideCharToMultiByte(CP_ACP,0,tempfname.c_str(),tempfname.size(),buf,buflen,0,0);
|
||||
if(ret == 0) {
|
||||
if (ret == 0)
|
||||
{
|
||||
delete[] buf;
|
||||
success = false;
|
||||
return strret;
|
||||
}
|
||||
buf[ret] = 0;
|
||||
std::string strret = buf;
|
||||
strret = buf;
|
||||
delete[] buf;
|
||||
success = true;
|
||||
return strret;
|
||||
|
@ -594,4 +598,4 @@ FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, std::str
|
|||
FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, std::string* innerFilename)
|
||||
{
|
||||
return FCEUD_OpenArchive(asr, fname, innerFilename, -1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue