Author: tsoome
Date: Sat Sep  8 19:17:22 2018
New Revision: 338535
URL: https://svnweb.freebsd.org/changeset/base/338535

Log:
  libsa: memory leak in tftp_open()
  
  tftpfile is allocated just above and needs to be freed.
  
  Reviewed by:  imp
  Approved by:  re (kib)
  Differential Revision:        https://reviews.freebsd.org/D17058

Modified:
  head/stand/libsa/tftp.c

Modified: head/stand/libsa/tftp.c
==============================================================================
--- head/stand/libsa/tftp.c     Sat Sep  8 18:57:29 2018        (r338534)
+++ head/stand/libsa/tftp.c     Sat Sep  8 19:17:22 2018        (r338535)
@@ -447,8 +447,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;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to