Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/ldpd Fix memory leak in error case. Found by cppcheck.



details:   https://anonhg.NetBSD.org/src/rev/166e4d3018c8
branches:  trunk
changeset: 760396:166e4d3018c8
user:      wiz <wiz%NetBSD.org@localhost>
date:      Tue Jan 04 09:42:21 2011 +0000

description:
Fix memory leak in error case. Found by cppcheck.

XXX: so_tag has same problem?

diffstat:

 usr.sbin/ldpd/mpls_interface.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (17 lines):

diff -r 27ca1a4bd889 -r 166e4d3018c8 usr.sbin/ldpd/mpls_interface.c
--- a/usr.sbin/ldpd/mpls_interface.c    Tue Jan 04 09:32:31 2011 +0000
+++ b/usr.sbin/ldpd/mpls_interface.c    Tue Jan 04 09:42:21 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mpls_interface.c,v 1.2 2010/12/09 00:10:59 christos Exp $ */
+/* $NetBSD: mpls_interface.c,v 1.3 2011/01/04 09:42:21 wiz Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -198,6 +198,7 @@
                so_ifa = malloc(sizeof(*so_ifa));
                if (!so_ifa) {
                        fatalp("Out of memory\n");
+                       free(so_nexthop);
                        return LDP_E_MEMORY;
                }
                memcpy(so_ifa, so_oldifa, so_oldifa->sa.sa_len);



Home | Main Index | Thread Index | Old Index