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

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

 



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?


+int main(int argc, char *argv[])
+{
+	int i = 0;

warning: unused variable 'i'


Have a nice day,
Berny--
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