Skip to content

test.cpp leaks memory #1

@GoogleCodeExporter

Description

@GoogleCodeExporter
The memory allocated to the resamplers array on line 80 in test.cpp has no 
corresponding call to delete.

80    Resampler* resamplers[max_components]; // memory allocated to this array 
is never deleted                                                                


81    std::vector<float> samples[max_components];                               


82                                                                              


83    resamplers[0] = new Resampler(src_width, src_height, dst_width, 
dst_height, Resampler::BOUNDARY_CLAMP, 0.0f, 1.0f, pFilter, NULL, NULL, 
filter_scale, filter_scale);                                                    

84    samples[0].resize(src_width);                                             


85    for (int i = 1; i < n; i++)                                               


86    {                                                                         


87       resamplers[i] = new Resampler(src_width, src_height, dst_width, 
dst_height, Resampler::BOUNDARY_CLAMP, 0.0f, 1.0f, pFilter, 
resamplers[0]->get_clist_x(), resamplers[0]->get_clist_y(), filter_scale, 
filter_scale);                
88       samples[i].resize(src_width);                                          


89    }

Fixed by adding
for (int = 0; i < n; ++i) { delete resamplers[ i ]; }
before returning from main().

Original issue reported on code.google.com by drt...@gmail.com on 5 Sep 2011 at 7:28

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions