Skip to content

pceplib: ignore NULL obj in free_obj api - #21487

Merged
Jafaral merged 1 commit into
FRRouting:masterfrom
mjstapp:fix_pcep_free_null
Apr 9, 2026
Merged

pceplib: ignore NULL obj in free_obj api#21487
Jafaral merged 1 commit into
FRRouting:masterfrom
mjstapp:fix_pcep_free_null

Conversation

@mjstapp

@mjstapp mjstapp commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Safely ignore a NULL obj pointer passed to the free_obj api.

Safely ignore a NULL obj pointer passed to the free_obj
api.

Signed-off-by: Mark Stapp <mjs@cisco.com>
@greptile-apps

greptile-apps Bot commented Apr 9, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds a defensive NULL check at the top of pcep_obj_free_object() in pceplib/pcep_msg_tools.c, so that callers passing a NULL pointer will get a safe no-op instead of a crash. The change is minimal and correct.

Confidence Score: 5/5

Safe to merge β€” a minimal, correct NULL guard with no side effects.

The change is a single, well-understood defensive check. It cannot introduce regressions, and all existing call sites that pass non-NULL objects are unaffected.

No files require special attention.

Vulnerabilities

No security concerns identified.

Important Files Changed

Filename Overview
pceplib/pcep_msg_tools.c Adds a NULL guard at the top of pcep_obj_free_object() to safely return early when a NULL pointer is passed, preventing potential NULL-dereference crashes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A([pcep_obj_free_object called]) --> B{obj == NULL?}
    B -- Yes --> C([return early, no-op])
    B -- No --> D{obj->tlv_list != NULL?}
    D -- Yes --> E[Iterate TLVs\npcep_obj_free_tlv each]
    E --> F[dll_destroy tlv_list]
    F --> G[switch on object_class\nfree specific object data]
    D -- No --> G
    G --> H[pceplib_free obj]
    H --> I([done])
Loading

Reviews (1): Last reviewed commit: "pceplib: ignore NULL obj in free_obj api" | Re-trigger Greptile

@Jafaral
Jafaral merged commit 02b54d6 into FRRouting:master Apr 9, 2026
25 checks passed
@mjstapp
mjstapp deleted the fix_pcep_free_null branch April 16, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants