hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r441587 - in /lucene/hadoop/trunk: CHANGES.txt src/c++/libhdfs/hdfs.c
Date Fri, 08 Sep 2006 17:41:47 GMT
Author: cutting
Date: Fri Sep  8 10:41:47 2006
New Revision: 441587

URL: http://svn.apache.org/viewvc?view=rev&rev=441587
Log:
HADOOP-458.  Fix a memory-corruption in libhdfs.  Contributed by Owen.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/c++/libhdfs/hdfs.c

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=441587&r1=441586&r2=441587
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Fri Sep  8 10:41:47 2006
@@ -155,6 +155,9 @@
 38. HADOOP-483. Improvements to libhdfs build and documentation.
     (Arun C Murthy via cutting)
 
+39. HADOOP-458.  Fix a memory corruption bug in libhdfs.
+    (omalley via cutting)
+
 
 Release 0.5.0 - 2006-08-04
 

Modified: lucene/hadoop/trunk/src/c++/libhdfs/hdfs.c
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/c%2B%2B/libhdfs/hdfs.c?view=diff&rev=441587&r1=441586&r2=441587
==============================================================================
--- lucene/hadoop/trunk/src/c++/libhdfs/hdfs.c (original)
+++ lucene/hadoop/trunk/src/c++/libhdfs/hdfs.c Fri Sep  8 10:41:47 2006
@@ -94,8 +94,12 @@
         		fprintf(stderr, "Please set the environment variable $CLASSPATH!\n");
         		exit(-1);
         } 
-        char *optHadoopClassPath = malloc(sizeof(char) * strlen(hadoopClassPath) + 16);
-        sprintf(optHadoopClassPath, "-Djava.class.path=%s", hadoopClassPath);
+        char *hadoopClassPathVMArg = "-Djava.class.path=";
+        size_t optHadoopClassPathLen = strlen(hadoopClassPath) + 
+        								strlen(hadoopClassPathVMArg) + 1;
+        char *optHadoopClassPath = malloc(sizeof(char) * optHadoopClassPathLen);
+        snprintf(optHadoopClassPath, optHadoopClassPathLen,
+        	"%s%s", hadoopClassPathVMArg, hadoopClassPath);
 
         //Create the VM
         JavaVMInitArgs vm_args;



Mime
View raw message