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

>  On 01/15/2014 06:13 PM, Paul Berry wrote:
>
> On 2 January 2014 03:58, Tapani Pälli <tapani.pa...@intel.com> wrote:
>
>> Signed-off-by: Tapani Pälli <tapani.pa...@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.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to