Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix NULL pointer deref when built with gcc -O1 or -O2
The C++ spec says "this" is always NON-NULL, recent versions of gcc will warn
about this and optimizes the "if (this)" we use in some places away:
"warning: nonnull argument ‘this’ compared to NULL [-Wnonnull-compare]"
We rely on "if (this)" checks in several places and refactoring this
is non trivial, so this commit adds a workaround using a helper function
for (this == NULL) checks which is marked as __attribute__((optimize("O0")))
when building with gcc.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>- Loading branch information
1 parent
3c674b1
commit 77a34f6
Showing
2 changed files
with
25 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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