Fix: invalid pointer usege 80/230880/2
authorBartlomiej Grzelewski <b.grzelewski@samsung.com>
Wed, 15 Apr 2020 15:51:46 +0000 (17:51 +0200)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Thu, 16 Apr 2020 08:54:47 +0000 (10:54 +0200)
If tts_create fails the code will try to dereference invalid ptr.

Change-Id: I7e4637cfc1a5a3b2e553bdec68b0da4ae96fcb81

src/screen_reader_tts.c

index 79478c45021563270634a482c1b565e61072db71..366150bad2e5e9ce0b445193aaaa1cb01b329fc6 100644 (file)
@@ -826,6 +826,11 @@ bool tts_init(void *data)
        int r = tts_create(&sd->tts);
        DEBUG("Create tts %d (%s)", r, get_tts_error(r));
 
+       if (TTS_ERROR_NONE != r) {
+               ERROR("Fail to create tts (%s)", get_tts_error(r));
+               return false;
+       }
+
        r = tts_set_mode(sd->tts, TTS_MODE_SCREEN_READER);
        DEBUG("Set tts mode SR %d (%s)", r, get_tts_error(r));