Sfoglia il codice sorgente

HDFS-596. Fix memory leak in hdfsFreeFileInfo() for libhdfs.
(Zhang Bingjun via dhruba)



git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20@880632 13f79535-47bb-0310-9956-ffa450edef68

Dhruba Borthakur 15 anni fa
parent
commit
d9363d64f9
2 ha cambiato i file con 10 aggiunte e 1 eliminazioni
  1. 3 0
      CHANGES.txt
  2. 7 1
      src/c++/libhdfs/hdfs.c

+ 3 - 0
CHANGES.txt

@@ -63,6 +63,9 @@ Release 0.20.2 - Unreleased
     MAPREDUCE-1068. Fix streaming job to show proper message if file is 
     is not present. (Amareshwari Sriramadasu via sharad)
 
+    HDFS-596. Fix memory leak in hdfsFreeFileInfo() for libhdfs.
+    (Zhang Bingjun via dhruba)
+
 Release 0.20.1 - 2009-09-01
 
   INCOMPATIBLE CHANGES

+ 7 - 1
src/c++/libhdfs/hdfs.c

@@ -2071,12 +2071,18 @@ hdfsFileInfo *hdfsGetPathInfo(hdfsFS fs, const char* path)
 
 void hdfsFreeFileInfo(hdfsFileInfo *hdfsFileInfo, int numEntries)
 {
-    //Free the mName
+    //Free the mName, mOwner, and mGroup
     int i;
     for (i=0; i < numEntries; ++i) {
         if (hdfsFileInfo[i].mName) {
             free(hdfsFileInfo[i].mName);
         }
+        if (hdfsFileInfo[i].mOwner) {
+            free(hdfsFileInfo[i].mOwner);
+        }
+        if (hdfsFileInfo[i].mGroup) {
+            free(hdfsFileInfo[i].mGroup);
+        }
     }
 
     //Free entire block