#12706: BParameterGroup::Unflatten() leaks fName
------------------------------+----------------------------
Reporter: ttcoder | Owner: Barrett
Type: bug | Status: new
Priority: normal | Milestone: R1
Component: Kits/Media Kit | Version: R1/Development
Resolution: | Keywords:
Blocked By: | Blocking:
Has a Patch: 0 | Platform: All
------------------------------+----------------------------
Comment (by ttcoder):
Details:
The
[http://xref.plausible.coop/source/xref/haiku/src/kits/media/ParameterWeb.cpp#1057
call] to
[http://xref.plausible.coop/source/xref/haiku/src/kits/media/ParameterWeb.cpp#read_string_from_buffer
read_string_from_buffer()] assigns it a new malloc()ed block without
freeing the original alloc from the ctor
And thus the one from the ctor is leaked, and appears in leak_analyzer.sh
outputs like this:
{{{
allocation: base: 0x6466ff0; size: 12; thread: 3788; alignment: 8
<libroot.so> panic(char const *,...) + 0x41ae (nearest)
<libroot.so> panic(char const *,...) + 0x4699 (nearest)
<libroot.so> panic(char const *,...) + 0x5c13 (nearest)
<libroot.so> panic(char const *,...) + 0x5c42 (nearest)
<libroot.so> malloc + 0x25
<libroot.so> strndup + 0x45
<libmedia.so> BParameterGroup::BParameterGroup(BParameterWeb *,
char const *) + 0x46
<libmedia.so> BParameterGroup::Unflatten(unsigned long, void const
*, long) + 0x4b6
<libmedia.so> BParameterWeb::Unflatten(unsigned long, void const
*, long) + 0x2a2
<libmedia.so> BMediaRoster::GetParameterWebFor(media_node const &,
BParameterWeb **) + 0x236
<libmedia.so> BSoundPlayer::_GetVolumeSlider(void) + 0x46
<libmedia.so> BSoundPlayer::_Init(media_node const *,
media_multi_audio_format const *, char const *, media_input const *, void
(*)(void *, void *, unsigned long, media_raw_audio_format const &), void
(*)(void *, BSoundPlayer::sound_player_notification,...), void *) + 0x7ff
<libmedia.so> BSoundPlayer::BSoundPlayer(media_raw_audio_format
const *, char const *, void (*)(void *, void *, unsigned long,
media_raw_audio_format const &), void (*)(void *,
BSoundPlayer::sound_player_notification,...), void *) + 0x98
}}}
read_string_from_buffer() should probably `free(*_string)` before assining
the new value `*_string = string;`
I'm tracking bigger leaks, but getting my feet wet with this easy one
first. Let's see if this gets a response...
--
Ticket URL: <https://dev.haiku-os.org/ticket/12706#comment:1>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.