Correct memory allocation for STRINGARRAY
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6968 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
06ddcbd151
commit
b985b7dbcc
1 changed files with 2 additions and 2 deletions
|
|
@ -33,9 +33,9 @@
|
|||
jstring j_string = (jstring)JCALL2(GetObjectArrayElement, jenv, $input, i);
|
||||
const char *c_string = JCALL2(GetStringUTFChars, jenv, j_string, 0);
|
||||
#ifdef __cplusplus
|
||||
$1[i] = new char [strlen((c_string)+1)];
|
||||
$1[i] = new char [strlen(c_string)+1];
|
||||
#else
|
||||
$1[i] = (char *)calloc(strlen((c_string)+1), sizeof(const char *));
|
||||
$1[i] = (char *)calloc(strlen(c_string)+1, sizeof(const char *));
|
||||
#endif
|
||||
strcpy($1[i], c_string);
|
||||
JCALL2(ReleaseStringUTFChars, jenv, j_string, c_string);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue