changeset 429:c1666427297c

Memory leak fixes by Bill May.
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 30 Jul 2002 07:25:43 +0000
parents 1338c24e30cb
children 60effdbf14ee
files src/video/Xext/Xv/Xv.c src/video/x11/SDL_x11yuv.c
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/Xext/Xv/Xv.c	Mon Jul 29 23:20:16 2002 +0000
+++ b/src/video/Xext/Xv/Xv.c	Tue Jul 30 07:25:43 2002 +0000
@@ -395,6 +395,7 @@
   *p_nEncodings = rep.num_encodings;
   *p_pEncodings = pes;
 
+  Xfree(buffer);
   UnlockDisplay(dpy);
   SyncHandle();
 
@@ -978,7 +979,6 @@
 
    UnlockDisplay(dpy);
    SyncHandle();
-
    return ret;
 }
 
--- a/src/video/x11/SDL_x11yuv.c	Mon Jul 29 23:20:16 2002 +0000
+++ b/src/video/x11/SDL_x11yuv.c	Tue Jul 30 07:25:43 2002 +0000
@@ -36,6 +36,7 @@
 #include <sys/shm.h>
 #include <X11/extensions/XShm.h>
 #include <XFree86/extensions/Xvlib.h>
+#include <X11/Xlibint.h>
 
 #include "SDL_error.h"
 #include "SDL_video.h"
@@ -130,6 +131,19 @@
 		}
 		SDL_NAME(XvFreeAdaptorInfo)(ainfo);
 	}
+
+    /*
+     * !!! FIXME:
+     * "Here are some diffs for X11 and yuv.  Note that the last part 2nd
+     *  diff should probably be a new call to XvQueryAdaptorFree with ainfo
+     *  and the number of adaptors, instead of the loop through like I did."
+     */
+ 	for ( i=0; i < adaptors; ++i ) {
+ 	  if (ainfo[i].name != NULL) Xfree(ainfo[i].name);
+ 	  if (ainfo[i].formats != NULL) Xfree(ainfo[i].formats);
+   	}
+ 	Xfree(ainfo);
+
 	if ( xv_port == -1 ) {
 		SDL_SetError("No available video ports for requested format");
 		return(NULL);