X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fcontrol.go;h=35e39f4c0497cd45f3d35d4e0a9a6bc5507c430f;hb=a8a908d1855ad80ac657078b909e90440e352412;hp=4978a8d8921ebbaa76be0874cd51b451b40c07d6;hpb=93113f869960fdd82623eb3b5258bcba4b232f54;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/control.go b/pkg/control/control.go index 4978a8d..35e39f4 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -191,6 +191,16 @@ func (c *Control) Consume(params *xapp.RMRParams) (err error) { defer c.Rmr.Free(msg.Mbuf) + // xapp-frame might use direct access to c buffer and + // when msg.Mbuf is freed, someone might take it into use + // and payload data might be invalid inside message handle function + // + // subscriptions won't load system a lot so there is no + // real performance hit by cloning buffer into new go byte slice + cPay := append(msg.Payload[:0:0], msg.Payload...) + msg.Payload = cPay + msg.PayloadLen = len(cPay) + switch msg.Mtype { case xapp.RIC_SUB_REQ: go c.handleXAPPSubscriptionRequest(msg)