Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search.c: Fix build failure due new GCC #1132

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

zdohnal
Copy link
Member

@zdohnal zdohnal commented Jan 7, 2025

The warning by GCC is false positive because we don't access the freed memory in the scope, only the pointer memory which contained address of allocated memory on the heap, and used that for updating index pointer.

Using ptrdiff_t struct before realloc works the warning around.

The warning by GCC is false positive because we don't access the freed
memory in the scope, only the pointer memory which contained address of
allocated memory on the heap, and used that for updating index pointer.

Using ptrdiff_t struct before realloc works the warning around.
@zdohnal zdohnal requested a review from michaelrsweet January 7, 2025 16:49
Copy link
Member

@michaelrsweet michaelrsweet left a comment

Choose a reason for hiding this comment

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

I really hate this crap - the warnings are bogus but they still push them out.

Note the code scanning report that the "if (lword)" before the free is no longer necessary, at least for CUPS 2.5.x. For CUPS 2.4.x (that still targets ANSI C) you want the NULL check.

@zdohnal
Copy link
Member Author

zdohnal commented Jan 7, 2025

I really hate this crap - the warnings are bogus but they still push them out.

The other way I got recommendation for is pragma, which I haven't used yet so I was inclined to try it, but this looks cleaner :( .

Note the code scanning report that the "if (lword)" before the free is no longer necessary, at least for CUPS 2.5.x. For CUPS 2.4.x (that still targets ANSI C) you want the NULL check.

Nice, I did not know about it! Read man page more, Zdenek :) ...

@zdohnal zdohnal merged commit 5c2b192 into OpenPrinting:master Jan 7, 2025
4 of 6 checks passed
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