devilhorns pushed a commit to branch master.

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

commit 3a395b4223960ac2554bfd90e0e891ba4423ad93
Author: Chris Michael <cp.mich...@samsung.com>
Date:   Fri Jun 26 10:25:42 2015 -0400

    mixer: Fix resource leaks
    
    This fixes Coverity CID1308395: Resource leak. Basically, don't bother
    allocating 'source' if we are just going to end up returning due to
    'eol' variable tests
    
    Signed-off-by: Chris Michael <cp.mich...@samsung.com>
---
 src/modules/mixer/lib/backends/pulseaudio/pulse.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/modules/mixer/lib/backends/pulseaudio/pulse.c 
b/src/modules/mixer/lib/backends/pulseaudio/pulse.c
index f0a04a7..382ccfc 100644
--- a/src/modules/mixer/lib/backends/pulseaudio/pulse.c
+++ b/src/modules/mixer/lib/backends/pulseaudio/pulse.c
@@ -422,9 +422,6 @@ _source_cb(pa_context *c EINA_UNUSED, const pa_source_info 
*info,
    Source *source;
    EINA_SAFETY_ON_NULL_RETURN(ctx);
 
-   source = calloc(1, sizeof(Source));
-   EINA_SAFETY_ON_NULL_RETURN(source);
-
    if (eol < 0)
      {
         if (pa_context_errno(c) == PA_ERR_NOENTITY)
@@ -437,6 +434,9 @@ _source_cb(pa_context *c EINA_UNUSED, const pa_source_info 
*info,
    if (eol > 0)
       return;
 
+   source = calloc(1, sizeof(Source));
+   EINA_SAFETY_ON_NULL_RETURN(source);
+
    source->idx = info->index;
    source->base.name = eina_stringshare_add(info->name);
    source->base.volume = _pa_cvolume_convert(info->volume);

-- 


Reply via email to