@@ -1460,38 +1460,39 @@ def visit_FUNCTION(self, node):
14601460
14611461 # Now free any local string from memory.
14621462 preserve_hl = False
1463- for local_var in node .local_symbol_table .values ():
1464- scope = local_var .scope
1465- if local_var .type_ == self .TYPE (TYPE .string ): # Only if it's string we free it
1466- if local_var .class_ != CLASS .array : # Ok just free it
1467- if scope == SCOPE .local or (scope == SCOPE .parameter and not local_var .byref ):
1468- if not preserve_hl :
1469- preserve_hl = True
1470- self .ic_exchg ()
1471-
1472- offset = - local_var .offset if scope == SCOPE .local else local_var .offset
1473- self .ic_fpload (TYPE .string , local_var .t , offset )
1474- self .runtime_call (RuntimeLabel .MEM_FREE , 0 )
1475- elif local_var .class_ == CLASS .const :
1476- continue
1477- else : # This is an array of strings, we must free it unless it's a by_ref array
1478- if scope == SCOPE .local or (scope == SCOPE .parameter and not local_var .byref ):
1479- if not preserve_hl :
1480- preserve_hl = True
1481- self .ic_exchg ()
1482-
1483- self .ic_param (gl .BOUND_TYPE , local_var .count )
1484- self ._local_array_load (scope , local_var )
1485- self .runtime_call (RuntimeLabel .ARRAYSTR_FREE_MEM , 0 )
1486-
1487- if local_var .class_ == CLASS .array and local_var .type_ != self .TYPE (TYPE .string ) and \
1488- (scope == SCOPE .local or (scope == SCOPE .parameter and not local_var .byref )):
1489- if not preserve_hl :
1490- preserve_hl = True
1491- self .ic_exchg ()
1492-
1493- self ._local_array_load (scope , local_var )
1494- self .runtime_call (RuntimeLabel .MEM_FREE , 0 )
1463+ if node .convention == CONVENTION .stdcall :
1464+ for local_var in node .local_symbol_table .values ():
1465+ scope = local_var .scope
1466+ if local_var .type_ == self .TYPE (TYPE .string ): # Only if it's string we free it
1467+ if local_var .class_ != CLASS .array : # Ok just free it
1468+ if scope == SCOPE .local or (scope == SCOPE .parameter and not local_var .byref ):
1469+ if not preserve_hl :
1470+ preserve_hl = True
1471+ self .ic_exchg ()
1472+
1473+ offset = - local_var .offset if scope == SCOPE .local else local_var .offset
1474+ self .ic_fpload (TYPE .string , local_var .t , offset )
1475+ self .runtime_call (RuntimeLabel .MEM_FREE , 0 )
1476+ elif local_var .class_ == CLASS .const :
1477+ continue
1478+ else : # This is an array of strings, we must free it unless it's a by_ref array
1479+ if scope == SCOPE .local or (scope == SCOPE .parameter and not local_var .byref ):
1480+ if not preserve_hl :
1481+ preserve_hl = True
1482+ self .ic_exchg ()
1483+
1484+ self .ic_param (gl .BOUND_TYPE , local_var .count )
1485+ self ._local_array_load (scope , local_var )
1486+ self .runtime_call (RuntimeLabel .ARRAYSTR_FREE_MEM , 0 )
1487+
1488+ if local_var .class_ == CLASS .array and local_var .type_ != self .TYPE (TYPE .string ) and \
1489+ (scope == SCOPE .local or (scope == SCOPE .parameter and not local_var .byref )):
1490+ if not preserve_hl :
1491+ preserve_hl = True
1492+ self .ic_exchg ()
1493+
1494+ self ._local_array_load (scope , local_var )
1495+ self .runtime_call (RuntimeLabel .MEM_FREE , 0 )
14951496
14961497 if preserve_hl :
14971498 self .ic_exchg ()
0 commit comments