From 4419162c07efd0c1539be3ab32aa913a9c3eda69 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 30 Jul 2002 07:25:43 +0000 Subject: [PATCH] Memory leak fixes by Bill May. --- src/video/Xext/Xv/Xv.c | 2 +- src/video/x11/SDL_x11yuv.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/video/Xext/Xv/Xv.c b/src/video/Xext/Xv/Xv.c index 11137d2b1..fa2f4b846 100644 --- a/src/video/Xext/Xv/Xv.c +++ b/src/video/Xext/Xv/Xv.c @@ -395,6 +395,7 @@ SDL_NAME(XvQueryEncodings)( *p_nEncodings = rep.num_encodings; *p_pEncodings = pes; + Xfree(buffer); UnlockDisplay(dpy); SyncHandle(); @@ -978,7 +979,6 @@ SDL_NAME(XvImage) * SDL_NAME(XvCreateImage) ( UnlockDisplay(dpy); SyncHandle(); - return ret; } diff --git a/src/video/x11/SDL_x11yuv.c b/src/video/x11/SDL_x11yuv.c index 7196bcfec..d0b419ef9 100644 --- a/src/video/x11/SDL_x11yuv.c +++ b/src/video/x11/SDL_x11yuv.c @@ -36,6 +36,7 @@ static char rcsid = #include #include #include +#include #include "SDL_error.h" #include "SDL_video.h" @@ -130,6 +131,19 @@ SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, S } 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);