pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-gprs/+/30921 )

Change subject: llc: Allow app provided callbacks to retain ownership of passed 
primitive
......................................................................

llc: Allow app provided callbacks to retain ownership of passed primitive

This way the app can, for instance, simply forward the primtiive pointer
from LLC callback to SNDCP layer, which will in the end take the
ownership of the primitive and free it.

Change-Id: I6ea91b8f190a399c4bcf6c7cba9a65809aaf3ddb
---
M src/llc/llc_prim.c
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved



diff --git a/src/llc/llc_prim.c b/src/llc/llc_prim.c
index e789819..b5fab8f 100644
--- a/src/llc/llc_prim.c
+++ b/src/llc/llc_prim.c
@@ -142,7 +142,9 @@
                rc = g_ctx->llc_up_cb(llc_prim, g_ctx->llc_up_cb_user_data);
        else
                rc = llc_up_cb_dummy(llc_prim, g_ctx->llc_up_cb_user_data);
-       msgb_free(llc_prim->oph.msg);
+       /* Special return value '1' means: do not free */
+       if (rc != 1)
+               msgb_free(llc_prim->oph.msg);
        return rc;
 }

@@ -178,7 +180,9 @@
                rc = g_ctx->llc_down_cb(llc_prim, g_ctx->llc_down_cb_user_data);
        else
                rc = llc_down_cb_dummy(llc_prim, g_ctx->llc_down_cb_user_data);
-       msgb_free(llc_prim->oph.msg);
+       /* Special return value '1' means: do not free */
+       if (rc != 1)
+               msgb_free(llc_prim->oph.msg);
        return rc;
 }




1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/30921
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I6ea91b8f190a399c4bcf6c7cba9a65809aaf3ddb
Gerrit-Change-Number: 30921
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to