nbd/client.c:385:12: warning: Potential leak of memory pointed to by 'buf'
Reported-by: Clang Static Analyzer
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <
20170727024224.22900-5-f4bug@amsat.org>
[introduced in commit
8ecaeae8]
Signed-off-by: Eric Blake <eblake@redhat.com>
if (info->request_sizes) {
stw_be_p(buf + 4 + len + 2, NBD_INFO_BLOCK_SIZE);
}
- if (nbd_send_option_request(ioc, NBD_OPT_GO,
- 4 + len + 2 + 2 * info->request_sizes, buf,
- errp) < 0) {
+ error = nbd_send_option_request(ioc, NBD_OPT_GO,
+ 4 + len + 2 + 2 * info->request_sizes,
+ buf, errp);
+ g_free(buf);
+ if (error < 0) {
return -1;
}