Patch for compositor-drm.c

Christopher Michael cpmichael1 at comcast.net
Thu Mar 8 10:59:59 PST 2012


On 03/08/2012 01:22 PM, Kristian Hoegsberg wrote:
> On Wed, Mar 07, 2012 at 03:00:04PM -0500, Christopher Michael wrote:
>> Hi All,
>>
>> Attached is a patch which fixes some cleanup issues for the
>> drm-based compositor. Basically, if we fail to allocate space for
>> the crtcs in the compositor, then we need to free the drm mode
>> resources before exiting the create_outputs function. We should also
>> free these resources (in the same create_outputs function) if the
>> compositor output_list is empty.
>
> Thanks, applied.  I edited the commit message to follow the git
> convention: first line is a summary, then a blank line and then
> further explanation, if needed.
>
No worries :) Thanks for applying :)

Sorry about the commit message. As this is the first real time I have 
used git, I was unaware of the conventions :( Pq and Soreau were kind 
enough to point me in the proper direction for this (for the future).

Cheers,
dh

>> Cheers,
>> devilhorns
>
>>  From a71519a4e82451a632165f3f910246c238af4ed4 Mon Sep 17 00:00:00 2001
>> From: Christopher Michael<cpmichael1 at comcast.net>
>> Date: Wed, 7 Mar 2012 14:55:21 -0500
>> Subject: [PATCH] When creating outputs in the drm compositor, if allocating crtcs fails, then free the drm resources. Also, if the base output list is empty, free drm resources
>>
>> ---
>>   src/compositor-drm.c |    5 ++++-
>>   1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
>> index 9796014..67fa500 100644
>> --- a/src/compositor-drm.c
>> +++ b/src/compositor-drm.c
>> @@ -1263,8 +1263,10 @@ create_outputs(struct drm_compositor *ec, int option_connector,
>>   	}
>>
>>   	ec->crtcs = calloc(resources->count_crtcs, sizeof(uint32_t));
>> -	if (!ec->crtcs)
>> +	if (!ec->crtcs) {
>> +		drmModeFreeResources(resources);
>>   		return -1;
>> +	}
>>
>>   	ec->num_crtcs = resources->count_crtcs;
>>   	memcpy(ec->crtcs, resources->crtcs, sizeof(uint32_t) * ec->num_crtcs);
>> @@ -1295,6 +1297,7 @@ create_outputs(struct drm_compositor *ec, int option_connector,
>>
>>   	if (wl_list_empty(&ec->base.output_list)) {
>>   		fprintf(stderr, "No currently active connector found.\n");
>> +		drmModeFreeResources(resources);
>>   		return -1;
>>   	}
>>
>> --
>> 1.7.4.1
>>




More information about the wayland-devel mailing list