svn commit: r319638 - head/usr.sbin/ppp

Stephen J. Kiernan stevek at FreeBSD.org
Tue Jun 6 21:51:06 UTC 2017


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 <trix at 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);


More information about the svn-src-head mailing list