src/msgb.c: avoid using internal talloc API

An internal symbol '_talloc_zero' of talloc library was used
during a msgb allocation. This is not actually good because:

  - it may be removed or modified by talloc developers;
  - the behaviour may be changed by talloc developers;
  - it's marked as internal using 'underscore';
  - there is public API to do the same.

So, let's use the public API.

Change-Id: I1080c9071e997944cc0f9fc3716129e9395437ad
This commit is contained in:
Vadim Yanitskiy 2018-03-08 21:57:42 +07:00
parent b42330516f
commit 10959cdea2
1 changed files with 4 additions and 2 deletions

View File

@ -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;