Mailing List Archive

Ticket #13438: Potential memory leak in RecorderBase::CheckForRingBufferSwitch
#13438: Potential memory leak in RecorderBase::CheckForRingBufferSwitch
------------------------------------------+---------------------------
Reporter: David Hampton | Owner: David Hampton
Type: Bug Report - Memory Leak | Status: assigned
Priority: minor | Milestone: 30.1
Component: MythTV - Recording | Version: Master Head
Severity: medium | Keywords:
Ticket locked: 0 |
------------------------------------------+---------------------------
At the end of the RecorderBase::CheckForRingBufferSwitch function,
m_tvrec->RingBufferChanged is called with recq as an argument, and that
function ends up freeing the memory pointed to by recq. Its theoretically
possible to get to this point and have m_tvrec be a nullptr, in which case
the function isn't called and recq isn't freed. The code needs to delete
recq in that case.

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13438>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13438: Potential memory leak in RecorderBase::CheckForRingBufferSwitch [ In reply to ]
#13438: Potential memory leak in RecorderBase::CheckForRingBufferSwitch
--------------------------------------+-------------------------------
Reporter: David Hampton | Owner: David Hampton
Type: Bug Report - Memory Leak | Status: closed
Priority: minor | Milestone: 30.1
Component: MythTV - Recording | Version: Master Head
Severity: medium | Resolution: fixed
Keywords: | Ticket locked: 0
--------------------------------------+-------------------------------
Changes (by David Hampton <mythtv@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"e6a39281b112fb03ef2f804c13bc6ebe9d336c90/mythtv"
e6a39281b/mythtv]:
{{{
#!CommitTicketReference repository="mythtv"
revision="e6a39281b112fb03ef2f804c13bc6ebe9d336c90"
tidy: Fix memory leak in HLSSegment::DecodeData.

The clang-tidy "memory leak" checker pointed out that the
RecorderBase::CheckForRingBufferSwitch function would leak the memory
pointed to by the 'recq' variable if the 'm_tvrec' variable contains
nullptr. Add a line to free the memory pointed to by the 'recq'
variable in this case.

Fixes #13438.
}}}

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13438#comment:1>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13438: Potential memory leak in RecorderBase::CheckForRingBufferSwitch [ In reply to ]
#13438: Potential memory leak in RecorderBase::CheckForRingBufferSwitch
--------------------------------------+-------------------------------
Reporter: David Hampton | Owner: David Hampton
Type: Bug Report - Memory Leak | Status: closed
Priority: minor | Milestone: 30.1
Component: MythTV - Recording | Version: Master Head
Severity: medium | Resolution: fixed
Keywords: | Ticket locked: 0
--------------------------------------+-------------------------------

Comment (by David Hampton <mythtv@…>):

In [changeset:"3af3cad3d74735a561ab594910a3400b2472645c/mythtv"
3af3cad3d7/mythtv]:
{{{
#!CommitTicketReference repository="mythtv"
revision="3af3cad3d74735a561ab594910a3400b2472645c"
tidy: Fix memory leak in HLSSegment::DecodeData.

The clang-tidy "memory leak" checker pointed out that the
RecorderBase::CheckForRingBufferSwitch function would leak the memory
pointed to by the 'recq' variable if the 'm_tvrec' variable contains
nullptr. Add a line to free the memory pointed to by the 'recq'
variable in this case.

Fixes #13438.

(cherry picked from commit e6a39281b112fb03ef2f804c13bc6ebe9d336c90)
}}}

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13438#comment:2>
MythTV <http://www.mythtv.org>
MythTV Media Center