mirror of https://github.com/axmolengine/axmol.git
[android] fixed #488: fix memory leak
This commit is contained in:
parent
8e44d5bc40
commit
91bc9a3f7a
|
@ -109,7 +109,13 @@ string CCFileUtils::getWriteablePath()
|
|||
{
|
||||
// the path is: /data/data/ + package name
|
||||
string dir("/data/data/");
|
||||
return dir + getPackageNameJNI() + "/" ;
|
||||
char* tmp = getPackageNameJNI();
|
||||
dir += tmp + "/" ;
|
||||
|
||||
// release memory
|
||||
delete tmp;
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
NS_CC_END;
|
||||
|
|
|
@ -404,10 +404,10 @@ extern "C"
|
|||
return rtn;
|
||||
}
|
||||
|
||||
const char* getPackageNameJNI()
|
||||
char* getPackageNameJNI()
|
||||
{
|
||||
TMethodJNI t;
|
||||
const char* ret = NULL;
|
||||
char* ret = NULL;
|
||||
|
||||
if (getMethodID(t
|
||||
, "org/cocos2dx/lib/Cocos2dxActivity"
|
||||
|
|
|
@ -34,7 +34,7 @@ extern "C"
|
|||
void disableAccelerometerJNI();
|
||||
void showMessageBoxJNI(const char * pszMsg, const char * pszTitle);
|
||||
void setKeyboardStateJNI(int bOpen);
|
||||
const char* getPackageNameJNI();
|
||||
char* getPackageNameJNI();
|
||||
}
|
||||
|
||||
#endif // __ANDROID_COCOS2D_JNI_H__
|
||||
|
|
Loading…
Reference in New Issue