Skip to content

Memory leak in api.c audio resampling #696

@pvaibhav

Description

@pvaibhav

Issue

There seems to be a memory leak in resampling code in api.c around line 2763 with the comment:

// No need to free - using static buffers

but in fact currently there are no static buffers. That buffer exists only in the "resampling optimisation" branch, the PR #592 is not merged yet.

Details

The git blame shows it sneaked in as part of another PR merge #573 .

I noticed this while perusing the resampling optimisation branch and wanting to apply it locally to test. But I remembered the peculiar comment already existed in my local copy.

The resampled.frames buffer it's supposed to free is most definitely mallocd in resample_audio() function. The resampling-optimisation branch does however use static buffers.

Solution

Simply revert to freeing the buffer:

free(resampled.frames);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions