[PATCH] Plug some memory leaks and an invalid read

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



'Twas brillig, and Colin Guthrie at 16/08/11 10:08 did gyre and gimble:
> Just out of curosity, is this what is causing:
> 
> I: [pulseaudio] module.c: Unloading "module-alsa-card" (index: #4).
> D: [pulseaudio] protocol-dbus.c: Interface org.PulseAudio.Core1.Device
> removed from object /org/pulseaudio/core1/sink0
> D: [pulseaudio] protocol-dbus.c: Interface org.PulseAudio.Core1.Sink
> removed from object /org/pulseaudio/core1/sink0
> E: [pulseaudio] core.h: Assertion 'pa_object_refcnt(pa_object_cast(o)) >
> 0' failed at ./pulsecore/core.h:184, function pa_core_assert_ref().
> Aborting.
> Aborted

It's not.

This is caused by a pa_core_assert_ref inside an unlink function....

It seems this is not valid when shutting down the server as
pa_core_unref() unrefs itself (thus ref-cnt==0), calls
pa_module_unload_all() which in turn triggers unlink hooks.

So two solutions:

1. Remove such asserts from those hooks that need it.
2. Re-ref/unref the core inside it's free function.
3. Call pa_module_unload_all() && pa_scache_free_all() before calling
pa_core_unref().

2 is hard to do (can't ref something with a ref-cnt already at 0) and 1
is a bit ugly as it imposes different rules on you (i.e. if the core
state is shutdown, then don't use the core), so I think 3 is the right
approach.

Col



-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux