mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
053108afd2
widget-common.c: In function 'widget_focus': widget-common.c:123:12: error: check of '*g.current' for NULL after already dereferencing it []8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Static-Analyzer-Options.html#index-Wanalyzer-deref-before-check-Werror=analyzer-deref-before-check]8;;] 123 | if (g->current == NULL || !widget_get_state (WIDGET (g->current->data), WST_FOCUSED)) | ^ 'widget_focus': event 1 | | 116 | if (g == NULL) | | ^ | | | | | (1) following 'false' branch (when 'g' is non-NULL)... | 'widget_focus': event 2 | | 119 | if (WIDGET (g->current->data) != w) | | ~^~~~~~~~~ | | | | | (2) ...to here ../../lib/widget/widget-common.h:15:31: note: in definition of macro 'WIDGET' | 15 | #define WIDGET(x) ((Widget *)(x)) | | ^ | 'widget_focus': event 3 | |widget-common.c:119:27: | 119 | if (WIDGET (g->current->data) != w) ../../lib/widget/widget-common.h:15:31: note: in definition of macro 'WIDGET' | 15 | #define WIDGET(x) ((Widget *)(x)) | | ^ | 'widget_focus': events 4-6 | |widget-common.c:119:8: | 119 | if (WIDGET (g->current->data) != w) | | ^ | | | | | (4) following 'true' branch... | 120 | { | 121 | widget_do_focus (WIDGET (g->current->data), FALSE); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (5) ...to here | 122 | /* Test if focus lost was allowed and focus has really been loose */ | 123 | if (g->current == NULL || !widget_get_state (WIDGET (g->current->data), WST_FOCUSED)) | | ~ | | | | | (6) pointer '*g.current' is checked for NULL here but it was already dereferenced at (3) | Found by gcc-14 analyzer Signed-off-by: Andreas Mohr <and@gmx.li> Signed-off-by: Andrew Borodin <aborodin@vmail.ru> |
||
---|---|---|
.. | ||
event | ||
filehighlight | ||
mcconfig | ||
search | ||
skin | ||
strutil | ||
tty | ||
vfs | ||
widget | ||
charsets.c | ||
charsets.h | ||
event-types.h | ||
event.h | ||
file-entry.h | ||
filehighlight.h | ||
fileloc.h | ||
fs.h | ||
glibcompat.c | ||
glibcompat.h | ||
global.c | ||
global.h | ||
hook.c | ||
hook.h | ||
idx.h | ||
intprops-internal.h | ||
intprops.h | ||
keybind.c | ||
keybind.h | ||
lock.c | ||
lock.h | ||
logging.c | ||
logging.h | ||
Makefile.am | ||
mcconfig.h | ||
search.h | ||
serialize.c | ||
serialize.h | ||
shell.c | ||
shell.h | ||
skin.h | ||
stat-size.h | ||
stdckdint.in.h | ||
strutil.h | ||
timefmt.c | ||
timefmt.h | ||
unixcompat.h | ||
util.c | ||
util.h | ||
utilunix.c | ||
widget.h |