From 8959bd2411ee735284235c7ab03611a7def651e6 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 1 Jan 2011 16:03:24 +0000 Subject: [PATCH] fix resource leak git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@989 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/60161ff9c293d3c867e045cfa4393ca60b0f0856 Author: Jacek Jendrzej Date: 2011-01-01 (Sat, 01 Jan 2011) Origin message was: ------------------ -fix resource leak git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@989 e54a6e83-5905-42d5-8d5c-058d10e6a962 ------------------ This commit was generated by Migit --- src/driver/netfile.cpp | 11 ++++++----- src/driver/pictureviewer/bmp.cpp | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/driver/netfile.cpp b/src/driver/netfile.cpp index 1c7e86ce9..db3de6668 100644 --- a/src/driver/netfile.cpp +++ b/src/driver/netfile.cpp @@ -765,7 +765,7 @@ FILE *f_open(const char *filename, const char *acctype) URL url; FILE *fd; int /*i,*/ compatibility_mode = 0; - char *ptr = NULL, buf[4096], type[10]; + char *ptr = NULL, buf[4096] = {0}, type[10] = {0}; if(acctype) strcpy(type, acctype); @@ -1776,16 +1776,17 @@ STREAM_FILTER *ShoutCAST_InitFilter(int meta_int) void ShoutCAST_MetaFilter(STREAM_FILTER *arg) { + + /* bug trap */ + if(!arg) + return; + FILTERDATA *filterdata = (FILTERDATA*)arg->user; int meta_int = filterdata->meta_int; int len = *arg->len; char*buf = (char*)arg->buf; int meta_start; - /* bug trap */ - if(!arg) - return; - #if 0 dprintf(stderr, "filter : cnt : %d\n", filterdata->cnt); dprintf(stderr, "filter : len : %d\n", filterdata->len); diff --git a/src/driver/pictureviewer/bmp.cpp b/src/driver/pictureviewer/bmp.cpp index 4c707462d..a666aa7bf 100644 --- a/src/driver/pictureviewer/bmp.cpp +++ b/src/driver/pictureviewer/bmp.cpp @@ -190,6 +190,7 @@ int fh_bmp_load(const char *name,unsigned char **buffer,int* xp,int* yp) if(tbuffer==NULL) { printf("Error: malloc\n"); + close(fd); return (FH_ERROR_MALLOC); } for (i=0; i