Author: stevek
Date: Tue Jun  6 21:51:04 2017
New Revision: 319638
URL: https://svnweb.freebsd.org/changeset/base/319638

Log:
  Before returning because of an memory allocation error, free the memory
  already allocated to buf.
  
  Found using clang's static analyzer - scan-build
  
  Submitted by: Thomas Rix <t...@juniper.net>
  Reviewed by:  stevek
  Approved by:  sjg (mentor)
  MFC after:    1 week
  Differential Revision:        https://reviews.freebsd.org/D9852

Modified:
  head/usr.sbin/ppp/iface.c

Modified: head/usr.sbin/ppp/iface.c
==============================================================================
--- head/usr.sbin/ppp/iface.c   Tue Jun  6 21:50:00 2017        (r319637)
+++ head/usr.sbin/ppp/iface.c   Tue Jun  6 21:51:04 2017        (r319638)
@@ -145,6 +145,7 @@ iface_Create(const char *name)
       iface = (struct iface *)malloc(sizeof *iface);
       if (iface == NULL) {
         fprintf(stderr, "iface_Create: malloc: %s\n", strerror(errno));
+       free(buf);
         return NULL;
       }
       iface->name = strdup(name);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to