[Mesa-dev] [wip 9/9] mesa: OES_get_program_binary extension functionality

Paul Berry stereotype441 at gmail.com
Fri Jan 17 08:55:34 PST 2014


On 16 January 2014 05:37, Tapani Pälli <tapani.palli at intel.com> wrote:

>  On 01/15/2014 06:13 PM, Paul Berry wrote:
>
> On 2 January 2014 03:58, Tapani Pälli <tapani.palli at intel.com> wrote:
>
>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>> ---
>>  src/mesa/main/shaderapi.c | 44
>> ++++++++++++++++++++++++++++++++++++++------
>>  1 file changed, 38 insertions(+), 6 deletions(-)
>>
>> +   char *data = mesa_program_serialize(shProg, &size);
>> +
>> +   /* we have more data that can fit to user given buffer */
>> +   if (size > bufSize) {
>> +      _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
>> +      if (data)
>> +         free(data);
>>
>
>  Why would we ever expect mesa_program_serialize to set size to a nonzero
> value but return NULL?  It seems like this could only happen if there's a
> bug, in which case this really ought to be
>
>  assert(data !=NULL);
>
>  Also, it's safe to call free() on a NULL pointer.  According to the C
> standard, freeing a NULL pointer does nothing.
>
>
> sure, will fix
>
>
>
>
>> +      return;
>> +   }
>> +
>> +   if (data) {
>>
>
>  Similarly, this if-statement is unnecessary.
>
>
> it is required for memcpy but not for free
>

Oops, you're right.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140117/67307a07/attachment.html>


More information about the mesa-dev mailing list