Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11660 closed Patch - Bug Fix (fixed)

Patch to initialize Initialize member variables in MythRenderOpenGL ctor - fixes Coverity 700926 and 700927

Reported by: Gary Buhrmaster <gary.buhrmaster@…> Owned by: Gary Buhrmaster <gary.buhrmaster@…>
Priority: minor Milestone: 0.27
Component: MythTV - User Interface Library Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Static analysis detected that the member variables were not being initialized in the MythRenderOpenGL ctor.

In actuality, after the OpenGL re-factor, the code appears to result in the ResetVars? and ResetProcs? functions being called from the ctors of MythRenderOpenGL[12], but invoke them explicitly in the ctor to keep Coverity happy.

Fixes Coverity 700926 and 700927

github ref: https://github.com/garybuhrmaster/mythtv/commit/99e0e577d7f5aa789fbeabffae8b989a61a72288

github git-am ref: https://github.com/garybuhrmaster/mythtv/commit/99e0e577d7f5aa789fbeabffae8b989a61a72288.patch

Change History (6)

comment:1 Changed 11 years ago by Jonatan Lindblad

This introduces a small leak of m_lock unless MythRenderOpenGL::ResetVars?() is removed from MythRenderOpenGL[12]::ResetVars?(void).

comment:2 in reply to:  1 ; Changed 11 years ago by Gary Buhrmaster <gary.buhrmaster@…>

Replying to natanojl:

This introduces a small leak of m_lock unless MythRenderOpenGL::ResetVars?() is removed from MythRenderOpenGL[12]::ResetVars?(void).

Good catch. Thanks. I had seen the "new" a month or so ago when I first reviewed a possible fix, and then completely forgot about it (and missed it) in this second pass. I'll try to get a revised patch worked out when I have some time this weekend. In case it takes me some time to get around to it, you should feel free to close this ticket (as "broken"/"wontfix") and I'll submit a new ticket with a new patch.

comment:3 in reply to:  2 Changed 11 years ago by Gary Buhrmaster <gary.buhrmaster@…>

Replying to Gary Buhrmaster <gary.buhrmaster@…>:

Replying to natanojl:

This introduces a small leak of m_lock unless MythRenderOpenGL::ResetVars?() is removed from MythRenderOpenGL[12]::ResetVars?(void).

Good catch. Thanks. I had seen the "new" a month or so ago when I first reviewed a possible fix, and then completely forgot about it (and missed it) in this second pass. I'll try to get a revised patch worked out when I have some time this weekend. In case it takes me some time to get around to it, you should feel free to close this ticket (as "broken"/"wontfix") and I'll submit a new ticket with a new patch.

Here is an additional patch (apply at the same time, or it can be applied first) that is a "minimal" fix that eliminates the use of the pointer and uses the initialization list (I can find no reason that was not done originally; I may have simply missed the history). A quick look suggests that most of the member variables should move to the initialization list (and would be a better long term fix). But that is a much bigger change, and then there is the longer term re-factor for all this code that would make it all moot anyway.

github ref: https://github.com/garybuhrmaster/mythtv/commit/ff042bddaf85a25f0faa019d081f1dd8921ed68d github git-am ref: https://github.com/garybuhrmaster/mythtv/commit/ff042bddaf85a25f0faa019d081f1dd8921ed68d.patch

comment:4 Changed 11 years ago by Gary Buhrmaster <gary.buhrmaster@…>

Owner: set to Gary Buhrmaster <gary.buhrmaster@…>
Resolution: fixed
Status: newclosed

In 07c54f07872c764f5f355775b27d9ee6f93daf0c/mythtv:

Initialize member variables in MythRenderOpenGL ctor

The refactor of the OpenGL code appears to result
in the ResetVars? and ResetProcs? functions being
called from the ctors of MythRenderOpenGL[12], but
invoke them explicitly to keep Coverity happy.

Fixes Coverity 700926 and 700927

Fixes #11660.

Signed-off-by: Paul Harrison <pharrison@…>

comment:5 Changed 11 years ago by Gary Buhrmaster <gary.buhrmaster@…>

In cd314dc6cab8b212221d6318876b2c3f46503a3e/mythtv:

Eliminate memory leak in MythRenderOpenGL

In commit 07c54f07872c764f5f355775b27d9ee6f93daf0c
a memory leak was introduced. This patch eliminates
the use of the pointer where the lock member object
is lost and replaces it by appropriate creation in
the initializer. This is a "minimal" fix to the issue.

Refs #11660

Signed-off-by: Paul Harrison <pharrison@…>

comment:6 Changed 11 years ago by paulh

Milestone: unknown0.27
Note: See TracTickets for help on using tickets.