Ticket #12622: trac-12622-cliquer-leaks.patch

File trac-12622-cliquer-leaks.patch, 1.2 KB (added by jason, 9 years ago)
  • sage/graphs/cliquer.pxd

    # HG changeset patch
    # User Jason Grout <jason.grout@drake.edu>
    # Date 1330766757 21600
    # Node ID 6c04dc1555d3628a56975db1b1f78b3726793aec
    # Parent  fb6bb2d905a963f3486e446bb7a3b64d89f7653d
    Fix several memory leaks in the cliquer interface.
    
    diff --git a/sage/graphs/cliquer.pxd b/sage/graphs/cliquer.pxd
    a b  
    2323
    2424cdef extern from "cliquer/graph.h":
    2525     cdef graph_t * graph_new(int n)
     26     cdef void graph_free(graph_t *g)
    2627     cdef void graph_print(graph_t *g)
    27 
  • sage/graphs/cliquer.pyx

    diff --git a/sage/graphs/cliquer.pyx b/sage/graphs/cliquer.pyx
    a b  
    2424
    2525
    2626include "../ext/interrupt.pxi"
     27include "../ext/stdsage.pxi"
    2728
    2829
    2930def max_clique(graph):
     
    7273    cdef int i
    7374    for i in range(size):
    7475        b.append(list[i])
     76    graph_free(g)
     77    sage_free(list)
    7578    return list_composition(b,d_inv)
    7679
    7780
     
    120123        else:
    121124            b.append(list_composition(c,d_inv))
    122125            c=[]
     126    graph_free(g)
     127    sage_free(list)
    123128    return b
    124129
    125130
     
    158163    sig_on()
    159164    c = sage_clique_number(g)
    160165    sig_off()
     166    graph_free(g)
    161167    return c
    162168
    163169