Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/ldpd CID 1125875: Fix memory leak
details: https://anonhg.NetBSD.org/src/rev/7592b49b2003
branches: trunk
changeset: 791334:7592b49b2003
user: christos <christos%NetBSD.org@localhost>
date: Wed Nov 13 21:22:46 2013 +0000
description:
CID 1125875: Fix memory leak
diffstat:
usr.sbin/ldpd/conffile.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (27 lines):
diff -r 632ebdb7cfae -r 7592b49b2003 usr.sbin/ldpd/conffile.c
--- a/usr.sbin/ldpd/conffile.c Wed Nov 13 21:20:21 2013 +0000
+++ b/usr.sbin/ldpd/conffile.c Wed Nov 13 21:22:46 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: conffile.c,v 1.9 2013/11/13 21:20:21 christos Exp $ */
+/* $NetBSD: conffile.c,v 1.10 2013/11/13 21:22:46 christos Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -377,12 +377,14 @@
Finterface(char *line)
{
char *ifname;
- struct conf_interface *conf_if = calloc(1, sizeof(*conf_if));
+ struct conf_interface *conf_if;
char buf[LINEMAXSIZE];
- ifname = NextCommand(line);
- if (conf_if == NULL || ifname == NULL)
+ if ((ifname = NextCommand(line)) == NULL)
return -1;
+ if ((conf_if = calloc(1, sizeof(*conf_if))) == NULL)
+ return -1;
+
strlcpy(conf_if->if_name, ifname, IF_NAMESIZE);
SLIST_INSERT_HEAD(&coifs_head, conf_if, iflist);
Home |
Main Index |
Thread Index |
Old Index