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
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 37127c1..f9d04fd 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -102,6 +102,8 @@
talloc_free(hdr);
return NULL;
}
+ } else {
+ talloc_steal(iofd->msgb_alloc.ctx, msg);
}
hdr->action = action;