comparison libmpcodecs/vf_screenshot.c @ 36757:18518cb8a99e

vf_screenshot: Fix memory leak on resolution/aspect changes.
author reimar
date Sun, 16 Feb 2014 14:47:36 +0000
parents 6e78b4f9569f
children 0fa1993a31c3
comparison
equal deleted inserted replaced
36756:6e78b4f9569f 36757:18518cb8a99e
69 static int config(struct vf_instance *vf, 69 static int config(struct vf_instance *vf,
70 int width, int height, int d_width, int d_height, 70 int width, int height, int d_width, int d_height,
71 unsigned int flags, unsigned int outfmt) 71 unsigned int flags, unsigned int outfmt)
72 { 72 {
73 int res; 73 int res;
74 if (vf->priv->ctx) sws_freeContext(vf->priv->ctx);
74 vf->priv->ctx=sws_getContextFromCmdLine(width, height, outfmt, 75 vf->priv->ctx=sws_getContextFromCmdLine(width, height, outfmt,
75 d_width, d_height, IMGFMT_RGB24); 76 d_width, d_height, IMGFMT_RGB24);
76 77
77 av_fast_malloc(&vf->priv->outbuffer, &vf->priv->outbuffer_size, d_width * d_height * 3 * 2); 78 av_fast_malloc(&vf->priv->outbuffer, &vf->priv->outbuffer_size, d_width * d_height * 3 * 2);
78 vf->priv->avctx->width = d_width; 79 vf->priv->avctx->width = d_width;