The latest cppcheck version (2.17.0) introduces a new check to check for 
properly handling errors on memory allocation failures 
(https://sourceforge.net/p/cppcheck/news/2025/02/cppcheck-2170/).

Multiple plugins are affected, some more, others less.

I wonder if it is worth to update all occurrences or ignore this check 
completely since at least the GLib memory allocation functions seems to 
terminate the whole application on errors (at the beginning of 
https://docs.gtk.org/glib/memory.html) and so our code to handle the errors 
probably will never be called.

On the opther hand, it might be still useful if any memory allocation returns 
NULL because of invalid input or other reasons without terminating the whole 
application.

I made a start in this PR but it's probably only about 5-10% of the 
necessary changes and in many places I just added TODOs to properly handle 
errors.

What do you think? @b4n @techee 

You can view, comment on, or merge this pull request online at:

  https://github.com/geany/geany-plugins/pull/1417

-- Commit Summary --

  * Fix a few nullPointerOutOfMemory warnings of cppcheck 2.17.0

-- File Changes --

    M addons/src/ao_xmltagging.c (2)
    M codenav/src/codenavigation.c (6)
    M codenav/src/switch_head_impl.c (8)
    M codenav/src/utils.c (3)
    M commander/src/commander-plugin.c (2)
    M geanyctags/src/geanyctags.c (2)
    M geanygendoc/src/ggd-file-type-manager.c (4)

-- Patch Links --

https://github.com/geany/geany-plugins/pull/1417.patch
https://github.com/geany/geany-plugins/pull/1417.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/1417
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany-plugins/pull/1...@github.com>

Reply via email to