free can't be executed when strdup "" in function getAddressFromInterface

Bug #1837344 reported by YeHuiSheng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Low
YeHuiSheng

Bug Description

In the funciton getAddressFromInterface, clstr_iface_name maybe point to strdup "" in get_clstr_iface.
When clstr_iface_name is point to strdup "", it is not null, but it's lenth is 0.
Then a little memory will be leaked because free won't be executed.
The strlen judgement need to be moved.

Tags: stx.metal
YeHuiSheng (hsye)
Changed in starlingx:
assignee: nobody → YeHuiSheng (hsye)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to metal (master)

Fix proposed to branch: master
Review: https://review.opendev.org/671952

Changed in starlingx:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on metal (master)

Change abandoned by YeHuiSheng (<email address hidden>) on branch: master
Review: https://review.opendev.org/671952

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to metal (master)

Fix proposed to branch: master
Review: https://review.opendev.org/671999

Revision history for this message
Ghada Khalil (gkhalil) wrote :

Low priority / not gating - code cleanup without any noted functional impact

Changed in starlingx:
importance: Undecided → Low
tags: added: stx.metal
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to metal (master)

Reviewed: https://review.opendev.org/671999
Committed: https://git.openstack.org/cgit/starlingx/metal/commit/?id=f945697f26f92bcd42f569868015d18ff04a1304
Submitter: Zuul
Branch: master

commit f945697f26f92bcd42f569868015d18ff04a1304
Author: YeHuiSheng <email address hidden>
Date: Mon Jul 22 17:15:27 2019 +0800

    Modify the strlen judgement to avoid memory leak.

    Change-Id: I4752ba24943b4c5e47e63b3c3e95811dec73ecce
    Closes-Bug: #1837344
    Signed-off-by: YeHuiSheng <email address hidden>

Changed in starlingx:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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