diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/msgb.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -79,14 +79,16 @@ struct msgb *msgb_alloc(uint16_t size, const char *name) { struct msgb *msg; - msg = _talloc_zero(tall_msgb_ctx, sizeof(*msg) + size, name); - + msg = talloc_named_const(tall_msgb_ctx, sizeof(*msg) + size, name); if (!msg) { LOGP(DLGLOBAL, LOGL_FATAL, "Unable to allocate a msgb: " "name='%s', size=%u\n", name, size); return NULL; } + /* Manually zero-initialize allocated memory */ + memset(msg, 0x00, sizeof(*msg) + size); + msg->data_len = size; msg->len = 0; msg->data = msg->_data; |