The pointer parameter value of the free function may be NULL

Bug #1838001 reported by xiaodonghu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Invalid
Low
Ambarish Das

Bug Description

The function sprint_realloc_objid may return NULL in abnormal case.
So, the function fmtoid and fmtmsg_var may return NULL.

However, in these function log_results log_pdu_header and log_invalid_oid_trees, the tempory value var_str point to the return value of fmtmsg_var may be NULL.

In these function, snmp_log have checked whether var_str is NULL or not, but free doesn't check it.
When the var_str is NULL, free(NULL) will make the program crashed.

So we need to add the checking before free function.

Tags: stx.fault
xiaodonghu (xiaodonghu)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fault (master)

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

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

Low priority / Not Gating - code cleanup suggestion / no noted system impact

tags: added: stx.fault
Changed in starlingx:
importance: Undecided → Low
assignee: nobody → xiaodonghu (xiaodonghu)
status: New → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on fault (master)

Change abandoned by Bart Wensley (<email address hidden>) on branch: master
Review: https://review.opendev.org/672935
Reason: This patch has been idle for more than six months. I am abandoning it to keep the review queue sane. If you are still interested in working on this patch, please unabandon it and upload a new patchset.

Ambarish Das (hiambar)
Changed in starlingx:
assignee: xiaodonghu (xiaodonghu) → Ambarish Das (hiambar)
Revision history for this message
Ambarish Das (hiambar) wrote :

As per C coding standard,compiler will treat free(NULL) as a no-op.(https://en.cppreference.com/w/c/memory/free)

This issue can be closed as invalid/won't fix.

Changed in starlingx:
status: Triaged → Invalid
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.