[PATCH] - Fix Unchecked memory usage.

Edward O'Callaghan eocallaghan at auroraux.org
Sat Jul 11 04:08:57 PDT 2009


Hi,

Any word on this getting committed ?

Regards,
Edward.

2009/7/8 Edward O'Callaghan <eocallaghan at auroraux.org>:
> Thanks Jeremy, your quite right.
>
> I normally just set pointers as NULL without thinking too much about
> it, figured its a good habit to have. :)
>
> Although it does not matter here, but you can remove the line if you
> really want.
>
> Have a good afternoon,
> Cheers,
> Edward.
>
> 2009/7/8 Jeremy Huddleston <jeremyhu at freedesktop.org>:
>> Maarten Maathuis wrote:
>>> Imagine what happens if everyone sent links. A patch is forgotten or
>>> maybe it's part a larger discussion. Suddenly the link dies, and part
>>> of the history is gone. It's really annoying to check mailinglist
>>> archives only to find dead links.
>>>
>>> Maarten.
>>>
>>
>> And it makes quoting in a reply easier...
>>
>> You don't need to initialize bufmgr_gem to NULL here since the first
>> thing you do is call calloc() for it... of course any decent optimized
>> compiler will simply ignore that '= NULL', but I figured I'd point it out.
>>
>> @@ -1389,13 +1395,16 @@ drm_intel_gem_bo_disable_reuse(drm_intel_bo *bo)
>>  drm_intel_bufmgr *
>>  drm_intel_bufmgr_gem_init(int fd, int batch_size)
>>  {
>> -    drm_intel_bufmgr_gem *bufmgr_gem;
>> +    drm_intel_bufmgr_gem *bufmgr_gem = NULL;
>>     struct drm_i915_gem_get_aperture aperture;
>>     drm_i915_getparam_t gp;
>>     int ret, i;
>>     unsigned long size;
>>
>>     bufmgr_gem = calloc(1, sizeof(*bufmgr_gem));
>> +    if (bufmgr_gem == NULL) {
>> +        return NULL;
>> +    }
>>     bufmgr_gem->fd = fd;
>>
>>     if (pthread_mutex_init(&bufmgr_gem->lock, NULL) != 0) {
>>
>>
>>
>
>
>
> --
> --
> Edward O'Callaghan
> http://www.auroraux.org/
> eocallaghan at auroraux dot org
>



-- 
-- 
Edward O'Callaghan
http://www.auroraux.org/
eocallaghan at auroraux dot org


More information about the xorg-devel mailing list