Skip to content

CWE-1164: Guarded free not needed#139

Open
ggelado wants to merge 1 commit intoivncd:mainfrom
ggelado:patch-1
Open

CWE-1164: Guarded free not needed#139
ggelado wants to merge 1 commit intoivncd:mainfrom
ggelado:patch-1

Conversation

@ggelado
Copy link
Copy Markdown
Contributor

@ggelado ggelado commented Jan 21, 2026

man 3 free | grep "NULL, no op"

In the C manual is specified that

If ptr is NULL, no operation is performed.

So the check is redundant and not needed


type: refactor
severity: low
cwe: CWE-1164
rule-id: cpp/guarded-free

@ggelado ggelado changed the title Guarded free not needed CWE-1164: Guarded free not needed Jan 21, 2026
@ggelado ggelado marked this pull request as ready for review January 21, 2026 19:29
Copilot AI review requested due to automatic review settings January 21, 2026 19:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes a redundant NULL check before calling free() on box->text in the tsl_set_box_text function. According to the C standard, free(NULL) is a safe no-op, making the guard unnecessary.

Changes:

  • Removed unnecessary NULL check before freeing box->text in tsl_set_box_text function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants