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 <brawner@gmail.com>
  • Loading branch information
brawner authored Aug 26, 2020
1 parent 2cb8042 commit 69953a2
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,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 @@ -255,6 +259,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 69953a2

Please sign in to comment.