Uploaded image for project: 'Hadoop Map/Reduce'
  1. Hadoop Map/Reduce
  2. MAPREDUCE-3914

Mismatched free() / delete / delete [] in HadoopPipes

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.20.205.0, 0.23.0, 1.0.0
    • Fix Version/s: 3.0.0-alpha1
    • Component/s: pipes
    • Labels:
      None
    • Environment:

      Based upon map reduce pipes task executed on Ubuntu 11.10

      Description

      When running valgrind on a simple MapReduce pipes job, valgrind identifies a mismatched new / delete:

      ==20394== Mismatched free() / delete / delete []
      ==20394== at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387)
      ==20394== by 0x4328A5: HadoopPipes::runTask(HadoopPipes::Factory const&) (HadoopPipes.cc:1171)
      ==20394== by 0x424C33: main (ProcessRow.cpp:118)
      ==20394== Address 0x9c5b540 is 0 bytes inside a block of size 131,072 alloc'd
      ==20394== at 0x4C2864B: operator new[](unsigned long) (vg_replace_malloc.c:305)
      ==20394== by 0x431E5D: HadoopPipes::runTask(HadoopPipes::Factory const&) (HadoopPipes.cc:1121)
      ==20394== by 0x424C33: main (ProcessRow.cpp:118)
      ==20394==
      ==20394== Mismatched free() / delete / delete []
      ==20394== at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387)
      ==20394== by 0x4328AF: HadoopPipes::runTask(HadoopPipes::Factory const&) (HadoopPipes.cc:1172)
      ==20394== by 0x424C33: main (ProcessRow.cpp:118)
      ==20394== Address 0x9c7b580 is 0 bytes inside a block of size 131,072 alloc'd
      ==20394== at 0x4C2864B: operator new[](unsigned long) (vg_replace_malloc.c:305)
      ==20394== by 0x431E6A: HadoopPipes::runTask(HadoopPipes::Factory const&) (HadoopPipes.cc:1122)
      ==20394== by 0x424C33: main (ProcessRow.cpp:118)

      The new [] calls in Lines 1121 and 1122 of HadoopPipes.cc:
      bufin = new char[bufsize];
      bufout = new char[bufsize];
      should have matching delete [] calls but are instead bracketed my delete on lines 1171 and 1172:
      delete bufin;
      delete bufout;
      So these should be replaced by delete[]

        Attachments

        1. MAPREDUCE-3914.patch
          0.6 kB
          Joe Mudd
        2. MAPREDUCE-3914-branch-1.0.patch
          0.5 kB
          Charles Earl
        3. MAPREDUCE-3914-branch-0.23.patch
          0.6 kB
          Charles Earl

          Activity

            People

            • Assignee:
              JoeM Joe Mudd
              Reporter:
              charlescearl Charles Earl
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified