Skip to content

Commit

Permalink
core: handle memory allocation failures in mctp init
Browse files Browse the repository at this point in the history
This just handles __mctp_alloc failures in libmctp.

Signed-off-by: Sumanth Bhat <[email protected]>
Change-Id: I0b5beaf2b981a56133bd6caaf269e75e28cefba7
  • Loading branch information
sumbhat90 committed Jul 14, 2020
1 parent 2c820c5 commit 96d5449
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ struct mctp *mctp_init(void)
struct mctp *mctp;

mctp = __mctp_alloc(sizeof(*mctp));

if(!mctp)
return NULL;

memset(mctp, 0, sizeof(*mctp));
mctp->max_message_size = MCTP_MAX_MESSAGE_SIZE;

Expand Down

0 comments on commit 96d5449

Please sign in to comment.