Skip to content
Permalink
Browse files

subsys: logging: Fix possible null dereference

Fixing a possible null dereferencing in log_msg_create_n

Signed-off-by: Subramanian Meenakshi Sundaram <subbu147@gmail.com>
  • Loading branch information...
subbu147 authored and nashif committed Aug 26, 2018
1 parent 9624593 commit 591985140b56715d4913bf4ac250341166d20552
Showing with 4 additions and 2 deletions.
  1. +4 −2 subsys/logging/log_msg.c
@@ -102,7 +102,7 @@ struct log_msg *log_msg_create_n(const char *str,
u32_t *args,
u32_t nargs)
{
struct log_msg *msg;
struct log_msg *msg = NULL;

if (nargs <= LOG_MSG_NARGS_SINGLE_CHUNK) {
msg = _log_msg_std_alloc();
@@ -124,7 +124,9 @@ struct log_msg *log_msg_create_n(const char *str,
(nargs - LOG_MSG_NARGS_HEAD_CHUNK)*sizeof(u32_t));
}
}
msg->str = str;
if (msg != NULL) {
msg->str = str;
}
return msg;
}

0 comments on commit 5919851

Please sign in to comment.
You can’t perform that action at this time.