diff --git a/sys/ximage/gstximagesrc.c b/sys/ximage/gstximagesrc.c
index 36c0b44..c257cea 100644
--- a/sys/ximage/gstximagesrc.c
+++ b/sys/ximage/gstximagesrc.c
@@ -442,6 +442,9 @@ gst_ximage_src_ximage_get (GstXImageSrc * ximagesrc)
 
   g_mutex_lock (ximagesrc->pool_lock);
   while (ximagesrc->buffer_pool != NULL) {
+    if (ximage) // pool not yet empty, so we need to free previous ximage
+      gst_ximage_buffer_free (ximage);
+
     ximage = ximagesrc->buffer_pool->data;
 
     if ((ximage->width != ximagesrc->width) ||
