Author: ngie
Date: Mon Mar 20 04:25:40 2017
New Revision: 315618
URL: https://svnweb.freebsd.org/changeset/base/315618

Log:
  syslogd: don't leak `f` on failure in cfline(..)
  
  Free `f` if an unknown priority or facility is parsed with the function.
  
  MFC after:    1 week
  Reported by:  Coverity
  CID:          1368068
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==============================================================================
--- head/usr.sbin/syslogd/syslogd.c     Mon Mar 20 03:52:06 2017        
(r315617)
+++ head/usr.sbin/syslogd/syslogd.c     Mon Mar 20 04:25:40 2017        
(r315618)
@@ -2117,6 +2117,7 @@ cfline(const char *line, const char *pro
                                (void)snprintf(ebuf, sizeof ebuf,
                                    "unknown priority name \"%s\"", buf);
                                logerror(ebuf);
+                               free(f);
                                return (NULL);
                        }
                }
@@ -2147,6 +2148,7 @@ cfline(const char *line, const char *pro
                                            "unknown facility name \"%s\"",
                                            buf);
                                        logerror(ebuf);
+                                       free(f);
                                        return (NULL);
                                }
                                f->f_pmask[i >> 3] = pri;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to