List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:November 24 2007 4:30am
Subject:Rev 286: Removed another spurious malloc of too much memory. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel

------------------------------------------------------------
revno: 286
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Fri 2007-11-23 20:30:22 -0800
message:
  Removed another spurious malloc of too much memory.
modified:
  java/ndbj.i                    ndbj.i-20070913223244-5938mztpztyn9sry-1
=== modified file 'java/ndbj.i'
--- a/java/ndbj.i	2007-11-24 04:25:00 +0000
+++ b/java/ndbj.i	2007-11-24 04:30:22 +0000
@@ -272,12 +272,12 @@
 %typemap(in) (unsigned noOfNames, const char ** names) {
     Uint32 i = 0;
     $1 = jenv->GetArrayLength($input);
-    $2 = (char **) malloc(($1+1)*sizeof(char *));
+    $2 = (char **) malloc(($1+1));
     /* make a copy of each string */
     for (i = 0; i<$1; i++) {
       jstring j_string = (jstring)(jenv->GetObjectArrayElement($input, i));
       const char * c_string = jenv->GetStringUTFChars(j_string, 0);
-      $2[i] = (char *)malloc(strlen((c_string)+1)*sizeof(const char *));
+      $2[i] = (char *)malloc(strlen((c_string)+1));
       strcpy($2[i], c_string);
       jenv->ReleaseStringUTFChars(j_string, c_string);
       jenv->DeleteLocalRef(j_string);

Thread
Rev 286: Removed another spurious malloc of too much memory. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/develMonty Taylor24 Nov