[ 
https://issues.apache.org/jira/browse/DISPATCH-1685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17252396#comment-17252396
 ] 

ASF subversion and git services commented on DISPATCH-1685:
-----------------------------------------------------------

Commit 45f586b72c70053af516851a67af8cafd8a30ec4 in qpid-dispatch's branch 
refs/heads/master from Jiri Daněk
[ https://gitbox.apache.org/repos/asf?p=qpid-dispatch.git;h=45f586b ]

NO-JIRA Use checked allocation API from DISPATCH-1685 (#948)

These are in response to fb-infer warnings of the following kind

/qpid-dispatch/src/router_core/core_events.c:46: error: Null Dereference
  pointer `sub` last assigned on line 45 could be null and is dereferenced by 
call to `memset()` at line 46, column 5.
  44. {
  45.     qdrc_event_subscription_t *sub = NEW(qdrc_event_subscription_t);
  46.     ZERO(sub);
          ^
  47.
  48.     sub->context         = context;

/qpid-dispatch/src/remote_sasl.c:72: error: Null Dereference
  pointer `buffer->start` last assigned on line 71 could be null and is 
dereferenced by call to `memset()` at line 72, column 5.
  70. {
  71.     buffer->start = malloc(buffer->capacity);
  72.     memset(buffer->start, 0, buffer->capacity);
          ^
  73. }
  74.

> Provide heap memory allocation wrappers that call abort() on failure to 
> allocate
> --------------------------------------------------------------------------------
>
>                 Key: DISPATCH-1685
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-1685
>             Project: Qpid Dispatch
>          Issue Type: New Feature
>            Reporter: Ken Giusti
>            Assignee: Ken Giusti
>            Priority: Major
>             Fix For: 1.13.0
>
>
> The dispatch router allocates heap memory using the malloc API.  In many 
> cases should a call to malloc fail to return the requested memory the router 
> cannot recover.  In fact there are many places in the code where the return 
> value from a heap allocation call is not even checked for NULL.
> This feature would provide a set of wrapper functions for all heap allocation 
> operations used by the router.  These wrapper functions will unconditionally 
> invoke abort() on heap allocation failure.  Note that these are not 
> conditionally compiled out when NDEBUG is defined - abort() is called 
> regardless of build type.
> The intent is to use these wrapper functions wherever a heap allocation 
> failure is not recoverable.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to