periscop / cloog

The CLooG Code Generator in the Polyhedral Model
GNU Lesser General Public License v2.1
40 stars 23 forks source link

annotate_loops(): fix memory leak #30

Closed harenome closed 8 years ago

harenome commented 8 years ago

In the previous implementation, claststmts would be freed at each end of the iteration of a while loop. However, if nclastloops == 0, the loop would continue to its next iteration without freeing claststmts.

The current implementation frees claststmts as soon as it is useless, ensuring it is always freed.

ftynse commented 8 years ago

Looks good to me.

It is not obvious why it is not the case for clastloops (conditions clastloops == NULL and nclastloops == 0 seem to be either both true or both false), but it does not seem to ever cause a leak.