[PATCH 09/17] Remove the host/server split for XV attributes.

Eric Anholt eric at anholt.net
Tue Sep 3 10:58:43 PDT 2013


Julien Cristau <jcristau at debian.org> writes:

> On Mon, Aug 26, 2013 at 13:26:15 -0700, Eric Anholt wrote:
>
>> ---
>>  hw/kdrive/ephyr/ephyrhostvideo.c | 107 -------------------------------
>>  hw/kdrive/ephyr/ephyrhostvideo.h |  19 ------
>>  hw/kdrive/ephyr/ephyrvideo.c     | 133 ++++++++++++++++++++++++---------------
>>  3 files changed, 82 insertions(+), 177 deletions(-)
>> 
> [...]
>> diff --git a/hw/kdrive/ephyr/ephyrvideo.c b/hw/kdrive/ephyr/ephyrvideo.c
>> index be59886..62f697c 100644
>> --- a/hw/kdrive/ephyr/ephyrvideo.c
>> +++ b/hw/kdrive/ephyr/ephyrvideo.c
> [...]
>> @@ -650,18 +656,23 @@ ephyrXVPrivGetImageBufSize(int a_port_id,
>>                             unsigned short a_width,
>>                             unsigned short a_height, int *a_size)
>>  {
>> +    xcb_connection_t *conn = hostx_get_xcbconn();
>> +    xcb_xv_query_image_attributes_cookie_t cookie;
>> +    xcb_xv_query_image_attributes_reply_t *reply;
>>      Bool is_ok = FALSE;
>> -    unsigned short width = a_width, height = a_height;
>>  
>>      EPHYR_RETURN_VAL_IF_FAIL(a_size, FALSE);
>>  
>>      EPHYR_LOG("enter\n");
>>  
>> -    if (!ephyrHostXVQueryImageAttributes(a_port_id, a_image_id,
>> -                                         &width, &height, a_size, NULL, NULL)) {
>> -        EPHYR_LOG_ERROR("failed to get image attributes\n");
>> +    cookie = xcb_xv_query_image_attributes(conn,
>> +                                           a_port_id, a_image_id,
>> +                                           a_width, a_height);
>> +    reply = xcb_xv_query_image_attributes_reply(conn, cookie, NULL);
>> +    if (!reply)
>>          goto out;
>> -    }
>> +
>> +    *a_size = reply->data_size;
>>      is_ok = TRUE;
>>  
>>   out:
>
> This seems to leak 'reply'.
>
> [...]
>> @@ -772,8 +781,12 @@ static int
>>  ephyrGetPortAttribute(KdScreenInfo * a_screen_info,
>>                        Atom a_attr_name, int *a_attr_value, pointer a_port_priv)
>>  {
>> +    xcb_connection_t *conn = hostx_get_xcbconn();
>>      int res = Success, host_atom = 0;
>>      EphyrPortPriv *port_priv = a_port_priv;
>> +    xcb_generic_error_t *e;
>> +    xcb_xv_get_port_attribute_cookie_t cookie;
>> +    xcb_xv_get_port_attribute_reply_t *reply;
>>  
>>      EPHYR_RETURN_VAL_IF_FAIL(port_priv, BadMatch);
>>      EPHYR_RETURN_VAL_IF_FAIL(ValidAtom(a_attr_name), BadMatch);
>> @@ -788,12 +801,15 @@ ephyrGetPortAttribute(KdScreenInfo * a_screen_info,
>>          goto out;
>>      }
>>  
>> -    if (!ephyrHostXVGetPortAttribute(port_priv->port_number,
>> -                                     host_atom, a_attr_value)) {
>> -        EPHYR_LOG_ERROR("failed to get port attribute\n");
>> +    cookie = xcb_xv_get_port_attribute(conn, port_priv->port_number, host_atom);
>> +    reply = xcb_xv_get_port_attribute_reply(conn, cookie, &e);
>> +    if (e) {
>> +        EPHYR_LOG_ERROR ("XvGetPortAttribute() failed: %d \n", e->error_code);
>> +        free(e);
>>          res = BadMatch;
>>          goto out;
>>      }
>> +    *a_attr_value = reply->value;
>>  
>>      res = Success;
>>   out:
>
> Missing free(reply) here too.

Fixed, thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20130903/a1370bd1/attachment-0001.pgp>


More information about the xorg-devel mailing list