aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-02-16 01:23:29 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-02-16 01:29:37 +0100
commitc9a4ce600afc5a11f36c78302f017db9918b4c36 (patch)
treef29162f49304f40d199647868613a8d6ce6118d3
parentb0c43a606334cb6d0796e9fb102823ce040224f6 (diff)
gsmtap_sendmsg(): clarify API doc concerning msgb ownership
Not freeing on error does enable callers to try to re-send as well, so it is a kind of useful feature, even though I find it likely for callers to either forget about freeing the msg on error or double-free by accident... I considered changing gsmtap_sendmsg() to always free, but since it is public API, I chose to keep and document its current behavior properly instead. We don't know what callers may exist out there. Change-Id: Id3266ce36442024f16eaf6afa3f516d201930c41
-rw-r--r--src/gsmtap_util.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c
index 8f9496a..8c044b1 100644
--- a/src/gsmtap_util.c
+++ b/src/gsmtap_util.c
@@ -266,6 +266,9 @@ int gsmtap_source_add_sink_fd(int gsmtap_fd)
* \param[in] gti GSMTAP instance
* \param[in] msg message buffer
* \return 0 in case of success; negative in case of error
+ * NOTE: in case of nonzero return value, the *caller* must free the msg!
+ * (This enables the caller to attempt re-sending the message.)
+ * If 0 is returned, the msgb was freed by this function.
*/
int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg)
{