Commit 0130ba95 authored by Sergio Costas's avatar Sergio Costas

Now doesn't fail when freeing the memory from python

parent 17bd7cf7
......@@ -55,18 +55,6 @@ class crusty(object):
self.status = crusty.STATUS_UNINITIALIZED
self.init_line = None
def __iter__(self):
self.iterator = self
return self
def __next__(self):
if self.iterator is None:
raise StopIteration
old_iterator = self.iterator
self.iterator = self.iterator.next
return old_iterator
def copy(self):
retval = crusty.AST_node()
for element in dir(self):
......@@ -151,14 +139,13 @@ class crusty(object):
if retval:
tree = self._fix_tree(retval)
retval = None
self.libcrusty.free_all()
else:
# If there is an error, run again the parsing with VERBOSE = True to show the error to the user
#self.libcrusty.parse_data(c_bool(True),c_char_p(filename.encode("utf8")),rv.stdout,datasize)
sys.exit(-1)
return tree
def free_all(self):
self.libcrusty.free_all()
def _fix_tree(self,node):
""" Creates a list with each statement in order, ready to be "executed" """
......
......@@ -254,8 +254,8 @@ void free_all() {
types_list = NULL;
full_tree = NULL;
char *previous_data_line = NULL;
char *current_data_line = NULL;
previous_data_line = NULL;
current_data_line = NULL;
int current_data_length = 0;
current_file = NULL;
column = 0;
......
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