Re: [GSoC][PATCH 1/2] sequencer: add NULL checks under read_author_script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rohit Ashiwal <rohit.ashiwal265@xxxxxxxxx> writes:

> +	if (name)
> +		*name = kv.items[name_i].util;
> +	else
> +		free(kv.items[name_i].util);
> +	if (email)
> +		*email = kv.items[email_i].util;
> +	else
> +		free(kv.items[email_i].util);
> +	if (date)
> +		*date = kv.items[date_i].util;
> +	else
> +		free(kv.items[date_i].util);
>  	retval = 0;

Some of the .util field may have been freed and others may have
taken possession by the caller at this point.

>  finish:
>  	string_list_clear(&kv, !!retval);

And we tell string_list_clear() not to free the .util field, so
kv.items[].util won't leak, which is good.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux