osmo_io: Ensure correct ownership of msgb when sending

Use talloc_steal() if a msg is passed in to osmo_io when sending. This
avoids the message being free()d early in case the original parent is
free()d.

Change-Id: Ie36bd68a8bd63e67d76fb41996f8fdf99f51d96c
This commit is contained in:
Daniel Willmann 2023-07-27 18:00:32 +02:00
parent ad9757a3b1
commit f083382b9c
1 changed files with 2 additions and 0 deletions

View File

@ -102,6 +102,8 @@ struct iofd_msghdr *iofd_msghdr_alloc(struct osmo_io_fd *iofd, enum iofd_msg_act
talloc_free(hdr);
return NULL;
}
} else {
talloc_steal(iofd->msgb_alloc.ctx, msg);
}
hdr->action = action;