examples/x11.c: fix possible memory leak if read fails
Detected by clang scan in line 224, column 21.
This commit is contained in:
parent
477e609a84
commit
86552bf2bb
@ -218,10 +218,13 @@ static int x11_send_receive(LIBSSH2_CHANNEL *channel, int sock)
|
||||
|
||||
/* Data in sock*/
|
||||
rc = read(sock, buf, bufsize);
|
||||
if (rc > 0)
|
||||
rc = libssh2_channel_write(channel,buf, rc);
|
||||
else
|
||||
if (rc > 0) {
|
||||
rc = libssh2_channel_write(channel, buf, rc);
|
||||
}
|
||||
else {
|
||||
free(buf);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
free(fds);
|
||||
|
Loading…
x
Reference in New Issue
Block a user