X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=liblttngctl%2Flttngctl.c;h=b64ace2e6d80de0ce085791f698604e53f8eb523;hp=b83d5ca92c83b516ade2f4c05336be116839b3fc;hb=83009e5e25be5591c5a08e018e95a7d9baf7c108;hpb=1e307fab325060d9db4e989c0fdc3cddf46f50f6 diff --git a/liblttngctl/lttngctl.c b/liblttngctl/lttngctl.c index b83d5ca92..b64ace2e6 100644 --- a/liblttngctl/lttngctl.c +++ b/liblttngctl/lttngctl.c @@ -343,6 +343,16 @@ static int ask_sessiond(struct lttcomm_session_msg *lsm, void **buf) 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;