[ https://issues.apache.org/jira/browse/PROTON-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14537725#comment-14537725 ]
ASF GitHub Bot commented on PROTON-727: --------------------------------------- Github user asfgit closed the pull request at: https://github.com/apache/qpid-proton/pull/27 > Add a NULL-pointer checks to malloc() and realloc() calls > --------------------------------------------------------- > > Key: PROTON-727 > URL: https://issues.apache.org/jira/browse/PROTON-727 > Project: Qpid Proton > Issue Type: Wish > Components: proton-c > Affects Versions: 0.8 > Reporter: German Shepherd (PrE) > Priority: Minor > > As we are running the ProtonC project on memory constrained systems, it is > possible for malloc() or realloc() to return a NULL, when there is no more > free heap to allocate the memory from. > Obviously, we might have a specific optimizations in the ProtonC code, which > deeply minimize the amount of a total heap required, but this is not what > this ticket is referring to. > In any case where there is no more free heap, or in a case where there is any > other issue with the allocators, the memory allocation functions return NULL. > The ProtonC code at this state, does not check for such a situation, and it > always expects the malloc() and realloc() to work and to return a valid > pointer. > I would like the developers to add a specific test to each place, where > memory allocation takes place, and to act upon an error properly (ideally - > with a graceful closure of the connection to broker, if possible). > Also, a proper signalization path to the user's application (which runs the > ProtonC client) would be a great addition. > If nothing fancy is planned, I would, at least, ask for adding the simple {{ > if (x == NULL) { do something }; }} tests to each every place where memory > allocation is handled. -- This message was sent by Atlassian JIRA (v6.3.4#6332)