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