# Buggy code
def _HashDataStream(self, file_entry, data_stream_name=""):
    """Hashes the contents of a specific data stream of a file entry.

    The resulting digest hashes are set in the parser mediator as attributes
    that are added to produced event objects. Note that some file systems
    allow directories to have data streams, e.g. NTFS.

    Args:
      file_entry: the file entry relating to the data to be hashed (instance of
                  dfvfs.FileEntry)
      data_stream_name: optional data stream name. The default is
                        an empty string which represents the default
                        data stream.
    """
    if not self._hasher_names:
        return

    logging.debug(
        "[HashDataStream] hashing file: {0:s}".format(self._current_display_name)
    )

    file_object = file_entry.GetFileObject(data_stream_name=data_stream_name)
    if not file_object:
        return

    # Make sure frame.f_locals does not keep a reference to file_entry.
    file_entry = None

    try:
        digest_hashes = hashers_manager.HashersManager.HashFileObject(
            self._hasher_names, file_object, buffer_size=self._DEFAULT_HASH_READ_SIZE
        )
    finally:
        file_object.close()

    if self._enable_profiling:
        self._ProfilingSampleMemory()

    for hash_name, digest_hash_string in iter(digest_hashes.items()):
        attribute_name = "{0:s}_hash".format(hash_name)
        self._parser_mediator.AddEventAttribute(attribute_name, digest_hash_string)

        logging.debug(
            "[HashDataStream] digest {0:s} calculated for file: {1:s}.".format(
                digest_hash_string, self._current_display_name
            )
        )

    logging.debug(
        "[HashDataStream] completed hashing file: {0:s}".format(
            self._current_display_name
        )
    )


# Traceback (CError)
plaso-1.3.1.post20151021

^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.7/multiprocessing/util.py", line 325, in _exit_function
p.join()
File "/usr/lib/python2.7/multiprocessing/process.py", line 145, in join
res = self._popen.wait(timeout)
File "/usr/lib/python2.7/multiprocessing/forking.py", line 154, in wait
return self.poll(0)
File "/usr/lib/python2.7/multiprocessing/forking.py", line 135, in poll
pid, sts = os.waitpid(self.pid, flag)
KeyboardInterrupt
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.7/multiprocessing/util.py", line 325, in _exit_function
p.join()
File "/usr/lib/python2.7/multiprocessing/process.py", line 145, in join
res = self._popen.wait(timeout)
File "/usr/lib/python2.7/multiprocessing/forking.py", line 154, in wait
return self.poll(0)
File "/usr/lib/python2.7/multiprocessing/forking.py", line 135, in poll
pid, sts = os.waitpid(self.pid, flag)
KeyboardInterrupt
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored
Exception TypeError: "'NoneType' object is not callable" in <Finalize object, dead> ignored\


analyst   4035  3335  0 Oct29 pts/19   00:00:57 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4045  4035  0 Oct29 pts/19   00:01:02 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4048  4035  0 Oct29 pts/19   00:00:39 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4051  4035  0 Oct29 pts/19   00:00:58 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4054  4035  0 Oct29 pts/19   00:00:41 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4060  4035  0 Oct29 pts/19   00:00:44 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4063  4035  0 Oct29 pts/19   00:00:40 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4066  4035  0 Oct29 pts/19   00:00:37 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4068  4035  0 Oct29 pts/19   00:00:40 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4070  4035  0 Oct29 pts/19   00:11:09 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4073  4035  0 Oct29 pts/19   00:00:37 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4076  4035  0 Oct29 pts/19   00:00:37 /usr/bin/python /usr/local/bin/log2timeline.py -p --vss-stores 1 srt.dump /media/usb1
analyst   4083  4035  1 Oct29 pts/19   00:14:40 [log2timeline.py] <defunct>

# Fixed code
def _HashDataStream(self, file_entry, data_stream_name=""):
    """Hashes the contents of a specific data stream of a file entry.

    The resulting digest hashes are set in the parser mediator as attributes
    that are added to produced event objects. Note that some file systems
    allow directories to have data streams, e.g. NTFS.

    Args:
      file_entry: the file entry relating to the data to be hashed (instance of
                  dfvfs.FileEntry)
      data_stream_name: optional data stream name. The default is
                        an empty string which represents the default
                        data stream.
    """
    if not self._hasher_names:
        return

    logging.debug(
        "[HashDataStream] hashing file: {0:s}".format(self._current_display_name)
    )

    self._status = definitions.PROCESSING_STATUS_HASHING

    file_object = file_entry.GetFileObject(data_stream_name=data_stream_name)
    if not file_object:
        return

    # Make sure frame.f_locals does not keep a reference to file_entry.
    file_entry = None

    try:
        digest_hashes = hashers_manager.HashersManager.HashFileObject(
            self._hasher_names, file_object, buffer_size=self._DEFAULT_HASH_READ_SIZE
        )
    finally:
        file_object.close()

    if self._enable_profiling:
        self._ProfilingSampleMemory()

    for hash_name, digest_hash_string in iter(digest_hashes.items()):
        attribute_name = "{0:s}_hash".format(hash_name)
        self._parser_mediator.AddEventAttribute(attribute_name, digest_hash_string)

        logging.debug(
            "[HashDataStream] digest {0:s} calculated for file: {1:s}.".format(
                digest_hash_string, self._current_display_name
            )
        )

    logging.debug(
        "[HashDataStream] completed hashing file: {0:s}".format(
            self._current_display_name
        )
    )