From ada8c66f1235903cf198dadff3f0ac4d78840e9b Mon Sep 17 00:00:00 2001 From: Oona Date: Sun, 21 Apr 2013 10:58:37 +0300 Subject: [PATCH] fix PixelGrid leaking memory --- Makefile | 2 +- gui.c | 12 ++++++------ video.c | 6 +++++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 3d54f1d..dc38a36 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ OBJECTS = common.o modespec.o gui.o video.o vis.o sync.o pcm.o fsk.o slowrx.o all: slowrx slowrx: $(OBJECTS) - $(CC) $(CFLAGS) -o $@ $(OBJECTS) $(GTKLIBS) -lfftw3 -lgthread-2.0 -lasound -lm + $(CC) $(CFLAGS) -o $@ $(OBJECTS) $(GTKLIBS) -lfftw3 -lgthread-2.0 -lasound -lm -lpthread %.o: %.c common.h $(CC) $(CFLAGS) $(GTKCFLAGS) $(OFLAGS) -c -o $@ $< diff --git a/gui.c b/gui.c index fc2707a..63a0d17 100644 --- a/gui.c +++ b/gui.c @@ -108,9 +108,9 @@ void setVU (double *Power, int FFTLen, int WinIdx, gboolean ShowWin) { pSNR[1] = 0xe4; pSNR[2] = 0x84; } else { - pSNR[0] = 0x00; - pSNR[1] = 0x50; - pSNR[2] = 0x30; + pSNR[0] = 0x20; + pSNR[1] = 0x20; + pSNR[2] = 0x20; } } else { if (y > 3 && y < H-3 && (W-1-x) % 16 >3 && x % 2 == 0) { @@ -131,9 +131,9 @@ void setVU (double *Power, int FFTLen, int WinIdx, gboolean ShowWin) { pPWR[0] = pPWR[1] = pPWR[2] = 0; if (logpow > p) { - pPWR[0] = clip(pPWR[0] + 0x22 * (logpow-p) / (HiBin-LoBin+1)); - pPWR[1] = clip(pPWR[1] + 0x66 * (logpow-p) / (HiBin-LoBin+1)); - pPWR[2] = clip(pPWR[2] + 0x22 * (logpow-p) / (HiBin-LoBin+1)); + pPWR[0] = 0;//clip(pPWR[0] + 0x22 * (logpow-p) / (HiBin-LoBin+1)); + pPWR[1] = 192;//clip(pPWR[1] + 0x66 * (logpow-p) / (HiBin-LoBin+1)); + pPWR[2] = 64;//clip(pPWR[2] + 0x22 * (logpow-p) / (HiBin-LoBin+1)); } /*if (ShowWin && LoBin >= GetBin(1200+CurrentPic.HedrShift, FFTLen) && diff --git a/video.c b/video.c index 33c21fb..32f6127 100644 --- a/video.c +++ b/video.c @@ -398,12 +398,16 @@ gboolean GetVideo(guchar Mode, double Rate, int Skip, gboolean Redraw) { setVU(Power, FFTLen, WinIdx, TRUE); } - if (Abort) return FALSE; + if (Abort) { + free(PixelGrid); + return FALSE; + } pcm.WindowPtr ++; } + free(PixelGrid); return TRUE; }