Mercurial > mplayer.hg
changeset 37072:9ed2c7f5c941
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.
author | ib |
---|---|
date | Thu, 24 Apr 2014 12:50:14 +0000 |
parents | c16af0693c42 |
children | 3ec195585bfd |
files | gui/interface.c |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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);