Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Check allocation of requester and replier (#60)
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Brawner <[email protected]>
  • Loading branch information
brawner committed Aug 26, 2020
1 parent 852ac9a commit de7ebb2
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ void * create_requester__@(service.namespaced_type.name)(
requester_params.datawriter_qos(*datawriter_qos);

RequesterType * requester = static_cast<RequesterType *>(_allocator(sizeof(RequesterType)));
if (NULL == requester) {
fprintf(stderr, "failed to allocate memory for requester\n");
return NULL;
}
try {
new (requester) RequesterType(requester_params);
} catch (...) {
Expand Down Expand Up @@ -252,6 +256,10 @@ void * create_replier__@(service.namespaced_type.name)(
replier_params.datawriter_qos(*datawriter_qos);

ReplierType * replier = static_cast<ReplierType *>(_allocator(sizeof(ReplierType)));
if (NULL == replier) {
fprintf(stderr, "failed to allocate memory for replier\n");
return NULL;
}
try {
new (replier) ReplierType(replier_params);
} catch (...) {
Expand Down

0 comments on commit de7ebb2

Please sign in to comment.