RE: [PATCH 1/2] lib/procutils: general purpose procfs parsing functions

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

 



On Wed, 2011-05-04 at 10:02 +0200, Voelker, Bernhard wrote:
> Davidlohr Bueso wrote:
> +struct proc_tasks *proc_open_tasks(pid_t pid)
> +{
> +	struct proc_tasks *tasks;
> +	char path[PATH_MAX];
> +	
> +	sprintf(path, "/proc/%d/task/", pid);
> +
> +	tasks = malloc(sizeof(struct proc_tasks));
> +	if (!tasks)
> +		return NULL;
> +
> +	tasks->dir = opendir(path);
> +	if (!tasks->dir)
> +		return NULL;
> +
> +	return tasks;
> +}
> 
> shouldn't tasks be freed if opendir fails?

Yes.

> +int main(int argc, char *argv[])
> +{
> +	int i = 0;
> 
> warning: unused variable 'i'

And yes.

Karel, would you rather have me resend a patch with these fixes or do it
yourself before applying (if you do such a thing)?

Thanks,
Davidlohr

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux