From c9a4ce600afc5a11f36c78302f017db9918b4c36 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 16 Feb 2018 01:23:29 +0100 Subject: 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 --- src/gsmtap_util.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c index 8f9496a8..8c044b1b 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) { -- cgit v1.2.3