1
1

examples/x11.c: fix possible memory leak if read fails

Detected by clang scan in line 224, column 21.
Этот коммит содержится в:
Marc Hoersken 2014-12-27 14:00:48 +01:00
родитель 477e609a84
Коммит 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);