1 | Attempts to fix any possible resource leaks. The resources that |
---|
2 | |
---|
3 | From: Erik Hovland <erik@hovland.org> |
---|
4 | |
---|
5 | are being tracked here are file handles and pointers and |
---|
6 | dynamically allocated memory. |
---|
7 | --- |
---|
8 | |
---|
9 | filters/convert/filter_convert.c | 2 +- |
---|
10 | libs/libmythdvdnav/dvd_reader.c | 2 ++ |
---|
11 | libs/libmythlivemedia/liveMedia/DarwinInjector.cpp | 4 +++- |
---|
12 | libs/libmythlivemedia/liveMedia/RTSPClient.cpp | 1 + |
---|
13 | libs/libmythtv/mpeg/mpegtables.cpp | 1 + |
---|
14 | programs/mythcommflag/ClassicLogoDetector.cpp | 1 + |
---|
15 | 6 files changed, 9 insertions(+), 2 deletions(-) |
---|
16 | |
---|
17 | diff --git a/filters/convert/filter_convert.c b/filters/convert/filter_convert.c |
---|
18 | index 8f27d5e..8eb7628 100644 |
---|
19 | --- a/filters/convert/filter_convert.c |
---|
20 | +++ b/filters/convert/filter_convert.c |
---|
21 | @@ -106,12 +106,12 @@ newConvertFilter (VideoFrameType inpixfmt, VideoFrameType outpixfmt, |
---|
22 | ThisFilter *filter; |
---|
23 | |
---|
24 | (void) options; |
---|
25 | - filter = malloc (sizeof (ThisFilter)); |
---|
26 | if ((inpixfmt != FMT_YUV422P || outpixfmt != FMT_YV12) && |
---|
27 | (inpixfmt != FMT_YV12 || outpixfmt != FMT_YUV422P) && |
---|
28 | (inpixfmt != outpixfmt)) |
---|
29 | return NULL; |
---|
30 | |
---|
31 | + filter = malloc (sizeof (ThisFilter)); |
---|
32 | if (filter == NULL) |
---|
33 | { |
---|
34 | fprintf (stderr, "Convert: failed to allocate memory for filter\n"); |
---|
35 | diff --git a/libs/libmythdvdnav/dvd_reader.c b/libs/libmythdvdnav/dvd_reader.c |
---|
36 | index 4d74001..3a448b5 100644 |
---|
37 | --- a/libs/libmythdvdnav/dvd_reader.c |
---|
38 | +++ b/libs/libmythdvdnav/dvd_reader.c |
---|
39 | @@ -587,10 +587,12 @@ static int findDirFile( const char *path, const char *file, char *filename ) |
---|
40 | sprintf( filename, "%s%s%s", path, |
---|
41 | ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ), |
---|
42 | ent->d_name ); |
---|
43 | + closedir( dir ); |
---|
44 | return 0; |
---|
45 | } |
---|
46 | } |
---|
47 | |
---|
48 | + closedir( dir ); |
---|
49 | return -1; |
---|
50 | } |
---|
51 | |
---|
52 | diff --git a/libs/libmythlivemedia/liveMedia/DarwinInjector.cpp b/libs/libmythlivemedia/liveMedia/DarwinInjector.cpp |
---|
53 | index 794cb31..5683623 100644 |
---|
54 | --- a/libs/libmythlivemedia/liveMedia/DarwinInjector.cpp |
---|
55 | +++ b/libs/libmythlivemedia/liveMedia/DarwinInjector.cpp |
---|
56 | @@ -250,7 +250,7 @@ SubstreamDescriptor::SubstreamDescriptor(RTPSink* rtpSink, |
---|
57 | char const* rtpPayloadFormatName = fRTPSink->rtpPayloadFormatName(); |
---|
58 | unsigned rtpTimestampFrequency = fRTPSink->rtpTimestampFrequency(); |
---|
59 | unsigned numChannels = fRTPSink->numChannels(); |
---|
60 | - char* rtpmapLine; |
---|
61 | + char* rtpmapLine = NULL; |
---|
62 | if (rtpPayloadType >= 96) { |
---|
63 | char* encodingParamsPart; |
---|
64 | if (numChannels != 1) { |
---|
65 | @@ -296,6 +296,8 @@ SubstreamDescriptor::SubstreamDescriptor(RTPSink* rtpSink, |
---|
66 | ++lastTrackId); // a=control:<track-id> |
---|
67 | fSDPLines = strDup(sdpLines); |
---|
68 | delete[] sdpLines; |
---|
69 | + if (rtpmapLine) |
---|
70 | + delete[] rtpmapLine; |
---|
71 | } |
---|
72 | |
---|
73 | SubstreamDescriptor::~SubstreamDescriptor() { |
---|
74 | diff --git a/libs/libmythlivemedia/liveMedia/RTSPClient.cpp b/libs/libmythlivemedia/liveMedia/RTSPClient.cpp |
---|
75 | index f750f55..66855ca 100644 |
---|
76 | --- a/libs/libmythlivemedia/liveMedia/RTSPClient.cpp |
---|
77 | +++ b/libs/libmythlivemedia/liveMedia/RTSPClient.cpp |
---|
78 | @@ -307,6 +307,7 @@ char* RTSPClient::describeURL(char const* url, Authenticator* authenticator, |
---|
79 | char* result = describeURL(redirectionURL); |
---|
80 | delete[] redirectionURL; |
---|
81 | delete[] serverType; |
---|
82 | + delete[] cmd; |
---|
83 | return result; |
---|
84 | } |
---|
85 | } |
---|
86 | diff --git a/libs/libmythtv/mpeg/mpegtables.cpp b/libs/libmythtv/mpeg/mpegtables.cpp |
---|
87 | index 0f90966..4985929 100644 |
---|
88 | --- a/libs/libmythtv/mpeg/mpegtables.cpp |
---|
89 | +++ b/libs/libmythtv/mpeg/mpegtables.cpp |
---|
90 | @@ -284,6 +284,7 @@ ProgramAssociationTable* ProgramAssociationTable::Create( |
---|
91 | // create PAT data |
---|
92 | if ((count * 4) >= (184 - (PSIP_OFFSET+1))) |
---|
93 | { // old PAT must be in single TS for this create function |
---|
94 | + delete pat; |
---|
95 | VERBOSE(VB_IMPORTANT, "PAT::Create: Error, old " |
---|
96 | "PAT size exceeds maximum PAT size."); |
---|
97 | return 0; |
---|
98 | diff --git a/programs/mythcommflag/ClassicLogoDetector.cpp b/programs/mythcommflag/ClassicLogoDetector.cpp |
---|
99 | index 264dd19..75a8b12 100644 |
---|
100 | --- a/programs/mythcommflag/ClassicLogoDetector.cpp |
---|
101 | +++ b/programs/mythcommflag/ClassicLogoDetector.cpp |
---|
102 | @@ -120,6 +120,7 @@ bool ClassicLogoDetector::searchForLogo(NuppelVideoPlayer* nvp) |
---|
103 | if (commDetector->m_bStop) |
---|
104 | { |
---|
105 | nvp->DiscardVideoFrame(vf); |
---|
106 | + delete edgeCounts; |
---|
107 | return false; |
---|
108 | } |
---|
109 | |
---|