# HG changeset patch # User ib # Date 1398343814 0 # Node ID 9ed2c7f5c94116bc34f39a46c43cdc1373812d7d # Parent c16af0693c42bffd26cbaaaefc15b992f8c3ba8e Rewrite add_vf(). Prefer calloc() to malloc(). As a result, vf_settings[1] doesn't need to be cleared. Additionally, check the result of the allocation. diff -r c16af0693c42 -r 9ed2c7f5c941 gui/interface.c --- a/gui/interface.c Thu Apr 24 12:44:33 2014 +0000 +++ b/gui/interface.c Thu Apr 24 12:50:14 2014 +0000 @@ -299,10 +299,13 @@ memset(&vf_settings[i + 1], 0, sizeof(m_obj_settings_t)); } } else { - vf_settings = malloc(2 * sizeof(m_obj_settings_t)); + vf_settings = calloc(2, sizeof(m_obj_settings_t)); + + if (!vf_settings) + return; + vf_settings[0].name = strdup(vf); vf_settings[0].attribs = NULL; - vf_settings[1].name = NULL; } mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_AddingVideoFilter, vf);