mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 10:04:32 +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> |
||
---|---|---|
.. | ||
background.c | ||
background.h | ||
button.c | ||
button.h | ||
buttonbar.c | ||
buttonbar.h | ||
check.c | ||
check.h | ||
dialog-switch.c | ||
dialog-switch.h | ||
dialog.c | ||
dialog.h | ||
frame.c | ||
frame.h | ||
gauge.c | ||
gauge.h | ||
group.c | ||
group.h | ||
groupbox.c | ||
groupbox.h | ||
history.c | ||
history.h | ||
hline.c | ||
hline.h | ||
input_complete.c | ||
input.c | ||
input.h | ||
label.c | ||
label.h | ||
listbox-window.c | ||
listbox-window.h | ||
listbox.c | ||
listbox.h | ||
Makefile.am | ||
menu.c | ||
menu.h | ||
mouse.c | ||
mouse.h | ||
quick.c | ||
quick.h | ||
radio.c | ||
radio.h | ||
rect.c | ||
rect.h | ||
widget-common.c | ||
widget-common.h | ||
wtools.c | ||
wtools.h |