Fast-Poisson-Image-Editing icon indicating copy to clipboard operation
Fast-Poisson-Image-Editing copied to clipboard

incorrect free memory

Open thuliu-yt16 opened this issue 1 year ago • 0 comments
trafficstars

Putting multiple array pointers in a single delete[] line is incorrect. E.g., in base_solver.h: https://github.com/Trinkle23897/Fast-Poisson-Image-Editing/blob/6a607f17e335a8be97cbfe39dd9b2de6de2a7cb6/fpie/core/base_solver.h#L28 and https://github.com/Trinkle23897/Fast-Poisson-Image-Editing/blob/6a607f17e335a8be97cbfe39dd9b2de6de2a7cb6/fpie/core/base_solver.h#L98 They lead to memory leaks.

Instead, they should be

    delete[]  A;
    delete[]  B;
    delete[]  X;

and

    delete[]  mask;
    delete[]  tgt;
    delete[]  grad;

thuliu-yt16 avatar Mar 01 '24 12:03 thuliu-yt16