Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in generate_cuts_in_lp_u() #154

Open
svigerske opened this issue Feb 26, 2019 · 0 comments
Open

Memory leak in generate_cuts_in_lp_u() #154

svigerske opened this issue Feb 26, 2019 · 0 comments
Assignees
Labels
bug Something isn't working LP module

Comments

@svigerske
Copy link
Member

Issue created by migration from Trac.

Original creator: casper

Original creation time: 2018-10-22 22:55:20

Assignee: @tkralphs

Version: 5.6.16

Keywords: memory leak

The following in lp_wrapper.c::generate_cuts_in_lp_u() has a memory leak:

  /* Test whether any of the new cuts are identical to any of
     the old ones. */
  if (p->waiting_row_num && new_row_num){
     for (i = 0, deleted_cut = FALSE; i < new_row_num;
          deleted_cut = FALSE){
        for (j = p->waiting_row_num - 1; j >= 0; j--){
           if (same_cuts_u(p, p->waiting_rows[j], new_rows[i]) !=
               DIFFERENT_CUTS){
              free_waiting_row(new_rows+i);
              new_rows[i] = new_rows[--new_row_num];
              deleted_cut = TRUE;
              break;
           }
        }
        if (!deleted_cut) i++;
     }
  }

/* CNMCNMCNM

  • leaks memory as if all cuts are the same as previously new_row_num will become 0,

  • and then new_rows will not be freed. Suggest to move FREE(new_rows) outside of if

  • statement.
    /
    if (new_row_num){
    add_new_rows_to_waiting_rows(p, new_rows, new_row_num);
    /
    FREE(new_rows); CNM suggest moving free from here /
    }
    FREE(new_rows); /
    CNM to here*/

    FREE(cuts);

@svigerske svigerske added this to the 5.2 milestone Feb 26, 2019
@svigerske svigerske added bug Something isn't working LP module labels Feb 26, 2019
@tkralphs tkralphs removed this from the 5.2 milestone Jul 4, 2019
@tkralphs tkralphs self-assigned this Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LP module
Projects
None yet
Development

No branches or pull requests

2 participants