From a0d7595206e8f536aaf14beb65015e50ceb4f32c Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 26 Oct 2012 18:05:30 +0000 Subject: libmpcodecs: fix coverity issues Fix check for empty log file (n contains a start offset of 15). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35269 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar Add missing (). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35270 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar Conflicts: libmpcodecs/vf_down3dright.c Add comment to silence coverity (and it generally doesn't hurt to make intentional fallthrough cases explicit). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35271 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar Make uninit function handle vf->priv being NULL. This happens in the case where memory allocation for it fails. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35272 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar Remove useless variable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35273 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar Conflicts: libmpcodecs/vf_softpulldown.c --- libmpcodecs/vf_divtc.c | 2 +- libmpcodecs/vf_down3dright.c | 12 ++++++------ libmpcodecs/vf_ilpack.c | 1 + libmpcodecs/vf_phase.c | 2 ++ libmpcodecs/vf_softpulldown.c | 17 +++++++---------- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libmpcodecs/vf_divtc.c b/libmpcodecs/vf_divtc.c index e04e7c0b4e..6faeb7c411 100644 --- a/libmpcodecs/vf_divtc.c +++ b/libmpcodecs/vf_divtc.c @@ -415,7 +415,7 @@ static int analyze(struct vf_priv_s *p) n++; } - if(!n) + if(n <= 15) { mp_msg(MSGT_VFILTER, MSGL_FATAL, "%s: Empty 2-pass log file.\n", vf_info_divtc.name); diff --git a/libmpcodecs/vf_down3dright.c b/libmpcodecs/vf_down3dright.c index 1119618e78..a263661592 100644 --- a/libmpcodecs/vf_down3dright.c +++ b/libmpcodecs/vf_down3dright.c @@ -100,12 +100,12 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { mp_image_t *dmpi; - // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next, IMGFMT_YV12, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | - (vf->priv->scaleh == 1) ? MP_IMGFLAG_READABLE : 0, - mpi->w * vf->priv->scalew, - mpi->h / vf->priv->scaleh - vf->priv->skipline); + // hope we'll get DR buffer: + dmpi=vf_get_image(vf->next, IMGFMT_YV12, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | + ((vf->priv->scaleh == 1) ? MP_IMGFLAG_READABLE : 0), + mpi->w * vf->priv->scalew, + mpi->h / vf->priv->scaleh - vf->priv->skipline); toright(dmpi->planes, mpi->planes, dmpi->stride, mpi->stride, mpi->w, mpi->h, vf->priv); diff --git a/libmpcodecs/vf_ilpack.c b/libmpcodecs/vf_ilpack.c index db4a849e1f..e98d70d85d 100644 --- a/libmpcodecs/vf_ilpack.c +++ b/libmpcodecs/vf_ilpack.c @@ -437,6 +437,7 @@ static int vf_open(vf_instance_t *vf, char *args) mp_msg(MSGT_VFILTER, MSGL_WARN, "ilpack: unknown mode %d (fallback to linear)\n", vf->priv->mode); + /* Fallthrough */ case 1: vf->priv->pack[0] = pack_li_0; vf->priv->pack[1] = pack_li_1; diff --git a/libmpcodecs/vf_phase.c b/libmpcodecs/vf_phase.c index b9ea66c506..f5d937ef70 100644 --- a/libmpcodecs/vf_phase.c +++ b/libmpcodecs/vf_phase.c @@ -242,6 +242,8 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) static void uninit(struct vf_instance *vf) { + if (!vf->priv) + return; free(vf->priv->buf[0]); free(vf->priv->buf[1]); free(vf->priv->buf[2]); diff --git a/libmpcodecs/vf_softpulldown.c b/libmpcodecs/vf_softpulldown.c index 5bd5e66bfd..d07f9d6e26 100644 --- a/libmpcodecs/vf_softpulldown.c +++ b/libmpcodecs/vf_softpulldown.c @@ -163,16 +163,13 @@ static void uninit(struct vf_instance *vf) static int vf_open(vf_instance_t *vf, char *args) { - struct vf_priv_s *p; - vf->config = config; - vf->put_image = put_image; - vf->uninit = uninit; - vf->default_reqs = VFCAP_ACCEPT_STRIDE; - vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); - vf->priv->state = 0; - vf->priv->last_frame_duration = 2; - vf_detc_init_pts_buf(&vf->priv->ptsbuf); - return 1; + vf->config = config; + vf->put_image = put_image; + vf->uninit = uninit; + vf->default_reqs = VFCAP_ACCEPT_STRIDE; + vf->priv = calloc(1, sizeof(struct vf_priv_s)); + vf->priv->state = 0; + return 1; } const vf_info_t vf_info_softpulldown = { -- cgit v1.2.3