daniel has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/34098 )


Change subject: osmo_io: Ensure correct ownership of msgb when sending
......................................................................

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
---
M src/core/osmo_io.c
1 file changed, 15 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/98/34098/1

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;

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34098
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ie36bd68a8bd63e67d76fb41996f8fdf99f51d96c
Gerrit-Change-Number: 34098
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <[email protected]>
Gerrit-MessageType: newchange

Reply via email to