summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2018-09-06 10:19:33 +0300
committerRobert Mustacchi <rm@joyent.com>2018-09-21 22:03:35 +0000
commit4667a9b13a267e53bf6c785cb5745b689f413f1d (patch)
tree1740aa23e2e6bd5ea071447afcad3071e190ce7b
parent1bb0ebc19aa99ecdb4a9bff9d5972a8320407a25 (diff)
downloadillumos-joyent-4667a9b13a267e53bf6c785cb5745b689f413f1d.tar.gz
9802 libstand: memory leak in tftp_open()
Reviewed by: Sebastian Wiedenroth <wiedi@frubar.net> Reviewed by: C Fraire <cfraire@me.com> Reviewed by: Gergő Mihály Doma <domag02@gmail.com> Approved by: Robert Mustacchi <rm@joyent.com>
-rw-r--r--usr/src/boot/lib/libstand/tftp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr/src/boot/lib/libstand/tftp.c b/usr/src/boot/lib/libstand/tftp.c
index c6d519d2ec..1e6beb0378 100644
--- a/usr/src/boot/lib/libstand/tftp.c
+++ b/usr/src/boot/lib/libstand/tftp.c
@@ -454,8 +454,10 @@ tftp_open(const char *path, struct open_file *f)
memset(tftpfile, 0, sizeof(*tftpfile));
tftpfile->tftp_blksize = TFTP_REQUESTED_BLKSIZE;
tftpfile->iodesc = io = socktodesc(*(int *) (f->f_devdata));
- if (io == NULL)
+ if (io == NULL) {
+ free(tftpfile);
return (EINVAL);
+ }
io->destip = servip;
tftpfile->off = 0;