The return value is passed as the first argument to g_strconcat(), which
expects a NULL-terminated argument list, but its documentation
explicitly states that the first argument must be non-NULL.
Change-Id: I2bfab7540fd0e717007399ed5e41fece644979e0
(cherry picked from commit
c71069943dc61d7332eefbca6a0b2d0fb8b53074)
static char *_get_sound_path(const char *file_path)
{
- char *dir;
- dir = app_get_resource_path();
+ char *dir = app_get_resource_path();
+ if (!dir)
+ return NULL;
+
char *path = g_strconcat(dir, "sounds/", file_path, NULL);
g_free(dir);
DEBUG("path: (%s)", path);
static void _play_sound(const char *file)
{
gchar *wav_path = _get_sound_path(file);
- if (wav_path)
- {
+ if (wav_path) {
mm_sound_play_keysound(wav_path, VOLUME_TYPE_MEDIA);
+ g_free(wav_path);
+ } else {
+ ERROR("Cannot play sound, the sound path is null");
}
- g_free(wav_path);
}
/**