Commit 11b544e1 by Pfosphor

Update kwarg processing to ensure modules don't receive a mutable reference to a…

Update kwarg processing to ensure modules don't receive a mutable reference to a class variable default. Fixes #207, also the Signature Modulemodule was leaking memory.
parent 291a0359
...@@ -10,6 +10,7 @@ import time ...@@ -10,6 +10,7 @@ import time
import inspect import inspect
import argparse import argparse
import traceback import traceback
from copy import copy
import binwalk.core.statuserver import binwalk.core.statuserver
import binwalk.core.common import binwalk.core.common
import binwalk.core.settings import binwalk.core.settings
...@@ -901,7 +902,7 @@ class Modules(object): ...@@ -901,7 +902,7 @@ class Modules(object):
if has_key(kwargs, module_argument.name): if has_key(kwargs, module_argument.name):
arg_value = kwargs[module_argument.name] arg_value = kwargs[module_argument.name]
else: else:
arg_value = module_argument.default arg_value = copy(module_argument.default)
setattr(obj, module_argument.name, arg_value) setattr(obj, module_argument.name, arg_value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment