Fix "Resource leak" issues reported by static analysis in Stx-ha

Bug #1791880 reported by haitao wang
272
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
High
Austin Sun

Bug Description

Title
-----

Fix "Resource leak" issues reported by static analysis in Stx-ha

Brief Description
-----------------

After triaging a scan report for C/C++ static code analysis, we found that there are high impact issues which need a fix. This meta bug will cover the resource leak" category in c/c++ code in Stx-ha.

Severity
--------
Provide the severity of the defect.
Major

Steps to Reproduce
------------------
Run a static analysis tool

haitao wang (hwang85)
Changed in starlingx:
assignee: nobody → haitao wang (hwang85)
Ken Young (kenyis)
tags: added: stx.security
Bruce Jones (brucej)
description: updated
Ken Young (kenyis)
Changed in starlingx:
status: New → Confirmed
importance: Undecided → High
Austin Sun (sunausti)
Changed in starlingx:
assignee: haitao wang (hwang85) → Austin Sun (sunausti)
Revision history for this message
Austin Sun (sunausti) wrote :

as aligned , we don't need fix by now.

https://review.openstack.org/#/c/611323/

These code changes are incorrect.
I intemperate that the goal for these open function calls are to open device /dev/null as fd=0,1,2 (or stdin, stdout and stderr). of which, stdin is rdonly and stdout and stderr are wronly.
The FDs are meant to open for the full life cycle of the thread. It may be better to close them at the exit of the thread if it needs to, but it wouldn't become resource leak unless the thread is to restart, which is not the case.

Changed in starlingx:
status: Confirmed → Invalid
Austin Sun (sunausti)
Changed in starlingx:
status: Invalid → Confirmed
Revision history for this message
Bruce Jones (brucej) wrote :

Please update this bug with specific file and line number information for the static analysis issue. Make sure the bug has enough information for someone to find the problem in the code without access to the tool or the report.

Revision history for this message
Austin Sun (sunausti) wrote :
Changed in starlingx:
status: Confirmed → Fix Released
Ken Young (kenyis)
tags: added: stx.2019.03
Ken Young (kenyis)
information type: Private Security → Public Security
Ken Young (kenyis)
tags: added: stx.2019.05
removed: stx.2019.03
Ken Young (kenyis)
tags: added: stx.2.0
removed: stx.2019.05
To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.