forked from enlightenment/enlightenment
pulse: do not leak strbuf
See also ac92ff5256
.
- eina_strbuf_string_get() returns the internally stored string as
a const char *, and does not free the strbuf itself
- eina_strbuf_string_steal() returns the internal string as a
char *, giving ownership to the caller, and frees the strbuf
itself
- eina_stringshare_add() takes a const char * as input and makes a
copy of the string
As a consequence, ss_add(sb_string_steal()) leaks the internal
string from the strbuf, while ss_add(sb_string_get()) leaks the
strbuf structure.
A one liner here would require either an eina_slstr based API or
an API in stringshare to take ownership of a given string. Both
would be useful APIs :)
This commit is contained in:
parent
e90f63b25b
commit
b173ed7be6
|
@ -338,6 +338,7 @@ _sink_input_cb(pa_context *c EINA_UNUSED, const pa_sink_input_info *info,
|
|||
eina_strbuf_append(input_name, ":");
|
||||
eina_strbuf_append(input_name, info->name);
|
||||
input->base.name = eina_stringshare_add(eina_strbuf_string_get(input_name));
|
||||
eina_strbuf_free(input_name);
|
||||
input->base.volume = _pa_cvolume_convert(&info->volume);
|
||||
input->base.mute = !!info->mute;
|
||||
EINA_LIST_FOREACH(ctx->sinks, l, s)
|
||||
|
|
Loading…
Reference in New Issue