#401 closed defect (fixed)
Memory leak in vf_screenshot.c
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Component: | vf |
Version: | HEAD | Severity: | normal |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Reproduced by developer: | no | Analyzed by developer: | no |
Description
static void uninit() is defined, but never executed. Therefor buffers are never
freed. Also, function needs to be moved up in the code:
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_screenshot.c,v
retrieving revision 1.6
diff -u -r1.6 vf_screenshot.c
--- libmpcodecs/vf_screenshot.c 12 Sep 2005 18:33:26 -0000 1.6
+++ libmpcodecs/vf_screenshot.c 29 Oct 2005 20:34:54 -0000
@@ -261,6 +261,13 @@
return 0;
}
+static void uninit(vf_instance_t *vf)
+{
+ if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
+ if (vf->priv->buffer) free(vf->priv->buffer);
+ free(vf->priv);
+}
+
open conflicts with stdio.h at least under MinGW
static int screenshot_open(vf_instance_t *vf, char* args)
{
@@ -268,6 +275,7 @@
vf->control=control;
vf->put_image=put_image;
vf->query_format=query_format;
+ vf->uninit=uninit;
vf->start_slice=start_slice;
vf->draw_slice=draw_slice;
vf->get_image=get_image;
@@ -280,14 +288,6 @@
return 1;
}
-static void uninit(vf_instance_t *vf)
-{
- if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
- if (vf->priv->buffer) free(vf->priv->buffer);
- free(vf->priv);
-}
-
-
Applied a slightly different patch (using a forward declaration instead of
moving it).