pceplib: ignore NULL obj in free_obj api - #21487
Merged
Merged
Conversation
Safely ignore a NULL obj pointer passed to the free_obj api. Signed-off-by: Mark Stapp <mjs@cisco.com>
Greptile SummaryThis PR adds a defensive NULL check at the top of Confidence Score: 5/5Safe 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.
|
| 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])
Reviews (1): Last reviewed commit: "pceplib: ignore NULL obj in free_obj api" | Re-trigger Greptile
Jafaral
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Safely ignore a NULL obj pointer passed to the free_obj api.