diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-04-10 01:21:16 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-04-10 01:21:16 +0200 |
commit | 9ae8ca2c3754abb9b6f6ce94c414c12d87419ac0 (patch) | |
tree | 3586b254321aa57758162f1648467fcd55ac2ea6 /src/pulsecore/source-output.c | |
parent | dcd4a73df94b0e9083f72d79f81083961bd15746 (diff) |
core: memory leak, fix ref counting when moving streams
Diffstat (limited to 'src/pulsecore/source-output.c')
-rw-r--r-- | src/pulsecore/source-output.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index 8918b431..489393a5 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -705,6 +705,8 @@ int pa_source_output_start_move(pa_source_output *o) { pa_source_update_status(o->source); o->source = NULL; + pa_source_output_unref(o); + return 0; } @@ -752,7 +754,7 @@ int pa_source_output_finish_move(pa_source_output *o, pa_source *dest, pa_bool_t o->source = dest; o->save_source = save; - pa_idxset_put(o->source->outputs, o, NULL); + pa_idxset_put(o->source->outputs, pa_source_output_ref(o), NULL); if (pa_source_output_get_state(o) == PA_SOURCE_OUTPUT_CORKED) o->source->n_corked++; @@ -804,11 +806,19 @@ int pa_source_output_move_to(pa_source_output *o, pa_source *dest, pa_bool_t sav if (!pa_source_output_may_move_to(o, dest)) return -PA_ERR_NOTSUPPORTED; - if ((r = pa_source_output_start_move(o)) < 0) + pa_source_output_ref(o); + + if ((r = pa_source_output_start_move(o)) < 0) { + pa_source_output_unref(o); return r; + } - if ((r = pa_source_output_finish_move(o, dest, save)) < 0) + if ((r = pa_source_output_finish_move(o, dest, save)) < 0) { + pa_source_output_unref(o); return r; + } + + pa_source_output_unref(o); return 0; } |