Coverity: Missing lock: CID 584
authorNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 13 Jan 2012 22:43:25 +0000 (17:43 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 13 Jan 2012 22:43:25 +0000 (17:43 -0500)
* src/media/sound-esd.c (sound_esd_play): Surround play_state
change with the necessary lock.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/media/sound-esd.c

index 110f5af..262b351 100644 (file)
@@ -373,6 +373,7 @@ sound_esd_play(audio_job_t aj)
                                mss, aj->buffer, resolution);
                        if (!len) {
                                ESD_DEBUG_S("finished\n");
+                               SXE_MUTEX_LOCK(&aj->mtx);
                                aj->play_state = MTPSTATE_STOP;
                                break;
                        }
@@ -405,7 +406,9 @@ sound_esd_play(audio_job_t aj)
                        if (wrtn < 0) {
                                ESD_DEBUG_S("writing to socket failed: %d.\n",
                                            wrtn);
+                               SXE_MUTEX_LOCK(&aj->mtx);
                                aj->play_state = MTPSTATE_STOP;
+                               SXE_MUTEX_UNLOCK(&aj->mtx);
                        }
                        break;
                case MTPSTATE_PAUSE: