summaryrefslogtreecommitdiff
path: root/channels/vgrabbers.c
diff options
context:
space:
mode:
authorLuigi Rizzo <rizzo@icir.org>2008-07-14 16:50:54 +0000
committerLuigi Rizzo <rizzo@icir.org>2008-07-14 16:50:54 +0000
commit3e9a95c16bf330f002e0ba0efc48aa4acddcb464 (patch)
treecd0ec695a1bfb94ff6de8d346dde3744d5dac2fe /channels/vgrabbers.c
parent6b9e40282ed6f5804039d729cbddc9c761556ab7 (diff)
free memory used by the x11 grabber when closing it.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@130733 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/vgrabbers.c')
-rw-r--r--channels/vgrabbers.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/channels/vgrabbers.c b/channels/vgrabbers.c
index 470a19f38..4afc12f61 100644
--- a/channels/vgrabbers.c
+++ b/channels/vgrabbers.c
@@ -69,6 +69,8 @@ struct grab_x11_desc {
struct fbuf_t b; /* geometry and pointer into the XImage */
};
+static void *grab_x11_close(void *desc); /* forward declaration */
+
/*! \brief open the grabber.
* We use the special name 'X11' to indicate this grabber.
*/
@@ -127,12 +129,7 @@ static void *grab_x11_open(const char *name, struct fbuf_t *geom, int fps)
return v;
error:
- /* XXX maybe XDestroy (v->image) ? */
- if (v->dpy)
- XCloseDisplay(v->dpy);
- v->dpy = NULL;
- ast_free(v);
- return NULL;
+ return grab_x11_close(v);
}
static struct fbuf_t *grab_x11_read(void *desc)
@@ -170,7 +167,8 @@ static void *grab_x11_close(void *desc)
{
struct grab_x11_desc *v = desc;
- XCloseDisplay(v->dpy);
+ if (v->dpy)
+ XCloseDisplay(v->dpy);
v->dpy = NULL;
v->image = NULL;
ast_free(v);