decoder/ffmpeg: fix crash on startup in mpd_ffmpeg_log_callback()
What's happening is the `ptr' argument to that function is NULL for me every time. `ptr' is unconditionally dereferenced to generate a log message, and this is where mpd crashes. Attached is a simple patch that tests for NULL and omits the log. With this patch the crash disappeared and mpd went back to working well.
This commit is contained in:

committed by
Max Kellermann

parent
c52f469c9c
commit
6a95898038
@@ -67,11 +67,16 @@ static void
|
|||||||
mpd_ffmpeg_log_callback(G_GNUC_UNUSED void *ptr, int level,
|
mpd_ffmpeg_log_callback(G_GNUC_UNUSED void *ptr, int level,
|
||||||
const char *fmt, va_list vl)
|
const char *fmt, va_list vl)
|
||||||
{
|
{
|
||||||
const AVClass *cls = *(const AVClass *const*)ptr;
|
const AVClass * cls = NULL;
|
||||||
char *domain = g_strconcat(G_LOG_DOMAIN, "/", cls->item_name(ptr), NULL);
|
|
||||||
|
|
||||||
g_logv(domain, level_ffmpeg_to_glib(level), fmt, vl);
|
if (ptr != NULL)
|
||||||
g_free(domain);
|
cls = *(const AVClass *const*)ptr;
|
||||||
|
|
||||||
|
if (cls != NULL) {
|
||||||
|
char *domain = g_strconcat(G_LOG_DOMAIN, "/", cls->item_name(ptr), NULL);
|
||||||
|
g_logv(domain, level_ffmpeg_to_glib(level), fmt, vl);
|
||||||
|
g_free(domain);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !OLD_FFMPEG_INCLUDES */
|
#endif /* !OLD_FFMPEG_INCLUDES */
|
||||||
|
Reference in New Issue
Block a user