Bug 95293 - Possible memory leak in src/modules/module-filter-apply.c
Summary: Possible memory leak in src/modules/module-filter-apply.c
Status: RESOLVED MOVED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: modules (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-06 06:29 UTC by Sachin Kumar Chauhan
Modified: 2018-07-30 10:08 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Sachin Kumar Chauhan 2016-05-06 06:29:28 UTC
In below function, 

static pa_hook_result_t process(struct userdata *u, pa_object *o, bool is_sink_input);

there seems a memory leak at Line No 452.


if (should_group_filter(fltr) && !find_paired_master(u, fltr, o, is_sink_input)) {
    pa_log_debug("Want group filtering but don't have enough streams.");
    return PA_HOOK_OK;
}

It is returning without freeing memory allocated to module_name.
Comment 1 Arun Raghavan 2016-05-06 06:37:12 UTC
Hey Sachin, you're right. Looking at the code, you'll also notice that fltr is being leaked. Would you like to submit a fix for this? It might make sense to initialise fltr and module_name as NULL, and then just have something like:

    if (something) {
       pa_log(...);
       goto done;
    }

    if (something else) {
       pa_log(...);
       goto done;
    }

done:
    pa_xfree(module_name);
    pa_xfree(fltr);

    return ...

This makes it more likely that we won't miss freeing if we add additional conditions.
Comment 2 Sachin Kumar Chauhan 2016-05-06 06:45:44 UTC
OK. I will modify the code accordingly and submit a patch soon.
Comment 3 Sachin Kumar Chauhan 2016-05-10 06:14:14 UTC
Dear Arun,

Patch has been sent to pulseaudio-discuss@lists.freedesktop.org
Comment 4 Arun Raghavan 2016-05-10 12:03:10 UTC
I'll take a look shortly. You need to subscribe to the list to send mails to it, but I've cleared your mail manually for now.
Comment 5 GitLab Migration User 2018-07-30 10:08:44 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/235.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.