Giter VIP home page Giter VIP logo

Comments (1)

thep avatar thep commented on August 29, 2024 2
> 1. Defect type: GCC_ANALYZER_WARNING
> 1. libdatrie-0.2.13/datrie/trie.c:1115:14: warning[-Wanalyzer-malloc-leak]: leak of 's'
> 41. libdatrie-0.2.13/datrie/trie.c:75:62: note: in definition of macro 'trie_da_get_tail_index'
> #  1113|           *alpha_p++ = alpha_map_trie_to_char (s->trie->alpha_map, *tail_str++);
> #  1114|       }
> #  1115|->     *alpha_p = 0;
> #  1116|   
> #  1117|       return alpha_key;

I can't see how 's' can be leaked here, as no allocated memory is associated to it,
and it's just a read-only const pointer. Regarding the macro trie_get_tail_index(),
it just expands to the harmless read-only da_get_base() call.

> 2. Defect type: GCC_ANALYZER_WARNING
> 1. libdatrie-0.2.13/datrie/trie-string.c:64:8: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'p'
> #    62|           *p++ = *str++;
> #    63|       }
> #    64|->     *p = TRIE_CHAR_TERM;
> #    65|   
> #    66|       return dup;

This one is reasonable, as p points to a block of malloc-ed memory (dup),
which can be NULL upon malloc() failure. Probably we should address it,
along with similar patterns in other places.

from libdatrie.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.