[PATCH 2/5] __glXDRIscreenProbe: free screen when DRI2Connect fails, instead of leaking it

Alan Coopersmith alan.coopersmith at oracle.com
Thu Feb 14 18:27:29 PST 2013


On 02/14/13 06:22 PM, Ian Romanick wrote:
> On 02/10/2013 12:39 PM, Alan Coopersmith wrote:
>> Reported with other leaks found by cppcheck in bugzilla #50281
>> https://bugs.freedesktop.org/show_bug.cgi?id=50281
>>
>> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
>> ---
>>   glx/glxdri2.c |    1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/glx/glxdri2.c b/glx/glxdri2.c
>> index b26e501..e014529 100644
>> --- a/glx/glxdri2.c
>> +++ b/glx/glxdri2.c
>> @@ -939,6 +939,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
>>                        &screen->fd, &driverName, &deviceName)) {
>>           LogMessage(X_INFO,
>>                      "AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum);
>> +        free(screen);
>>           return NULL;
> 
> Couldn't this just 'goto handle_error' instead?  As far as I can tell, that
> should handle things correctly (but would result in an additional message in the
> log).

Right - I wasn't sure if that would be a bad thing or not.   If an additional
    LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n");
is acceptable, then I can goto handle_error instead.

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the xorg-devel mailing list