rtspconnection: Annotate RTSP message parameters correctly
authorPatricia Muscalu <patricia@axis.com>
Wed, 22 Feb 2023 13:14:15 +0000 (14:14 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Fri, 24 Feb 2023 01:04:23 +0000 (01:04 +0000)
These parameters are not actually `out` parameters but must
be allocated and zero-initialized by the calling function.
Marking them as `out caller-allocates` will cause memory
corruptions when calling these APIs from e.g., Python code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4061>

subprojects/gst-plugins-base/gst-libs/gst/rtsp/gstrtspconnection.c
subprojects/gst-plugins-base/gst-libs/gst/rtsp/gstrtspmessage.c

index 8e63747..ae1e9d4 100644 (file)
@@ -2807,7 +2807,7 @@ no_message:
 /**
  * gst_rtsp_connection_receive_usec:
  * @conn: a #GstRTSPConnection
- * @message: (out caller-allocates): the message to read
+ * @message: (transfer none): the message to read
  * @timeout: a timeout value or 0
  *
  * Attempt to read into @message from the connected @conn, blocking up to
@@ -5158,7 +5158,7 @@ gst_rtsp_connection_send_messages (GstRTSPConnection * conn,
 /**
  * gst_rtsp_connection_receive:
  * @conn: a #GstRTSPConnection
- * @message: (out caller-allocates): the message to read
+ * @message: (transfer none): the message to read
  * @timeout: a timeout value or %NULL
  *
  * Attempt to read into @message from the connected @conn, blocking up to
index 00f87e7..ed62636 100644 (file)
@@ -136,7 +136,7 @@ gst_rtsp_message_new (GstRTSPMessage ** msg)
 
 /**
  * gst_rtsp_message_init:
- * @msg: (out caller-allocates): a #GstRTSPMessage
+ * @msg: (transfer none): a #GstRTSPMessage
  *
  * Initialize @msg. This function is mostly used when @msg is allocated on the
  * stack. The reverse operation of this is gst_rtsp_message_unset().
@@ -201,7 +201,7 @@ gst_rtsp_message_new_request (GstRTSPMessage ** msg, GstRTSPMethod method,
 
 /**
  * gst_rtsp_message_init_request:
- * @msg: (out caller-allocates): a #GstRTSPMessage
+ * @msg: (transfer none): a #GstRTSPMessage
  * @method: the request method to use
  * @uri: (transfer none): the uri of the request
  *
@@ -295,7 +295,7 @@ gst_rtsp_message_new_response (GstRTSPMessage ** msg, GstRTSPStatusCode code,
 
 /**
  * gst_rtsp_message_init_response:
- * @msg: (out caller-allocates): a #GstRTSPMessage
+ * @msg: (transfer none): a #GstRTSPMessage
  * @code: the status code
  * @reason: (transfer none) (nullable): the status reason or %NULL
  * @request: (transfer none) (nullable): the request that triggered the response or %NULL
@@ -421,7 +421,7 @@ gst_rtsp_message_new_data (GstRTSPMessage ** msg, guint8 channel)
 
 /**
  * gst_rtsp_message_init_data:
- * @msg: (out caller-allocates): a #GstRTSPMessage
+ * @msg: (transfer none): a #GstRTSPMessage
  * @channel: a channel
  *
  * Initialize a new data #GstRTSPMessage for @channel.