[PATCH 3/3] compositor: dump command line options

Bill Spitzak spitzak at gmail.com
Mon Mar 19 07:27:36 PDT 2012


On 03/19/2012 05:08 AM, Pekka Paalanen wrote:

>> +	if (help) {
>> +		dump_options(core_options, ARRAY_LENGTH(core_options));
>> +		argv[argc] = strdup("--help");
>> +		argc++;
>
> How do you know there is space in argv[] to add that?
> Also, doesn't strdup() leak here?

There is always one null at the end of argv. Although this fills it in, 
so it is assuming the called code does not look for this null but uses 
argc correctly.

I agree an assignment would work as well as strdup.




More information about the wayland-devel mailing list