# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1336122074 7200
# Node ID bc0193e33aa070aa7b85e51d0e9a1eecee20d2a9
# Parent f58cebb10eeeb8e1fcaed9f36f953f475c338f95
Fixing memory leaks in Cliquer
diff git a/sage/graphs/cliquer.pxd b/sage/graphs/cliquer.pxd
a

b


19  19  cdef int sage_clique_max(graph_t *g, int ** list) 
20  20  cdef int sage_all_clique_max(graph_t *g, int ** list) 
21  21  cdef int sage_clique_number(graph_t *g) 
22   cdef void parse_input(char *str,graph_t *g) 
23  22  
24  23  cdef extern from "cliquer/graph.h": 
25  24  cdef graph_t * graph_new(int n) 
26  25  cdef void graph_print(graph_t *g) 
 26  cdef void parse_input(char *str,graph_t *g) 
 27  cdef void graph_free(graph_t *g) 
27  28  
diff git a/sage/graphs/cliquer.pyx b/sage/graphs/cliquer.pyx
a

b


34  34  
35  35  
36  36  include "../ext/interrupt.pxi" 
37   
 37  include '../ext/stdsage.pxi' 
38  38  
39  39  def max_clique(graph): 
40  40  """ 
… 
… 

82  82  cdef int i 
83  83  for i in range(size): 
84  84  b.append(list[i]) 
 85  
 86  sage_free(list) 
 87  graph_free(g) 
85  88  return list_composition(b,d_inv) 
86  89  
87  90  
… 
… 

152  155  else: 
153  156  b.append(list_composition(c,d_inv)) 
154  157  c=[] 
 158  
 159  sage_free(list) 
 160  graph_free(g) 
 161  
155  162  return sorted(b) 
156  163  
157  164  
… 
… 

189  196  cdef int c 
190  197  sig_on() 
191  198  c = sage_clique_number(g) 
 199  graph_free(g) 
192  200  sig_off() 
193  201  return c 
194  202  