From: Mathieu Desnoyers Date: Fri, 26 Aug 2011 17:52:32 +0000 (-0400) Subject: Merge branch 'master' of ssh://git.lttng.org/home/git/lttng-tools X-Git-Tag: v2.0-pre13~19^2 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=f8f0c3d1337c4eda5fb76a323ffe6c21c926a21e;hp=-c Merge branch 'master' of ssh://git.lttng.org/home/git/lttng-tools --- f8f0c3d1337c4eda5fb76a323ffe6c21c926a21e diff --combined liblttngctl/lttngctl.c index c2b1242d8,b64ace2e6..4b803dc5b --- a/liblttngctl/lttngctl.c +++ b/liblttngctl/lttngctl.c @@@ -21,18 -21,17 +21,17 @@@ */ #define _GNU_SOURCE - #include #include + #include #include #include #include #include - #include - #include - #include "lttngerr.h" - #include "lttng-share.h" + #include + #include + #include /* Socket to session daemon for communication */ static int sessiond_socket; @@@ -153,10 -152,6 +152,10 @@@ static int check_tracing_group(const ch /* Alloc group list of the right size */ grp_list = malloc(grp_list_size * sizeof(gid_t)); + if (!grp_list) { + ret = -1; + goto end; + } grp_id = getgroups(grp_list_size, grp_list); if (grp_id < -1) { perror("getgroups"); @@@ -348,6 -343,16 +347,16 @@@ static int ask_sessiond(struct lttcomm_ goto end; } + /* + * Extra protection not to dereference a NULL pointer. If buf is NULL at + * this point, an error is returned and data is freed. + */ + if (buf == NULL) { + ret = -1; + free(data); + goto end; + } + *buf = data; ret = size;