jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=b173ed7be6beee016d96d4c78eaad641507fbe2c

commit b173ed7be6beee016d96d4c78eaad641507fbe2c
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Tue Jul 11 10:45:26 2017 +0900

    pulse: do not leak strbuf
    
    See also ac92ff52567293399060bfd35b22ae86fe.
    - 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 :)
---
 src/modules/mixer/lib/backends/pulseaudio/pulse.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/modules/mixer/lib/backends/pulseaudio/pulse.c 
b/src/modules/mixer/lib/backends/pulseaudio/pulse.c
index 56446fcf4..ec1bdc1b4 100644
--- a/src/modules/mixer/lib/backends/pulseaudio/pulse.c
+++ b/src/modules/mixer/lib/backends/pulseaudio/pulse.c
@@ -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)

-- 


Reply via email to