Source-Changes-HG archive

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

[src/trunk]: src/lib/libnpf set to NULL after releasing to avoid double free.



details:   https://anonhg.NetBSD.org/src/rev/52be56243184
branches:  trunk
changeset: 820203:52be56243184
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 03 00:59:31 2017 +0000

description:
set to NULL after releasing to avoid double free.

diffstat:

 lib/libnpf/npf.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 9d3ce64a86c7 -r 52be56243184 lib/libnpf/npf.c
--- a/lib/libnpf/npf.c  Tue Jan 03 00:58:05 2017 +0000
+++ b/lib/libnpf/npf.c  Tue Jan 03 00:59:31 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf.c,v 1.42 2016/12/27 20:32:58 rmind Exp $   */
+/*     $NetBSD: npf.c,v 1.43 2017/01/03 00:59:31 christos Exp $        */
 
 /*-
  * Copyright (c) 2010-2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.42 2016/12/27 20:32:58 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.43 2017/01/03 00:59:31 christos Exp $");
 
 #include <sys/types.h>
 #include <netinet/in_systm.h>
@@ -805,7 +805,7 @@
        uint64_t id = 0;
 
        (void)prop_dictionary_get_uint64(rldict, "id", &id);
-       return (unsigned)id;
+       return id;
 }
 
 const void *
@@ -1330,6 +1330,7 @@
                goto out;
 
        prop_object_release(conn_res);
+       conn_res = NULL;
 
 #if !defined(_NPF_STANDALONE)
        error = prop_dictionary_sendrecv_ioctl(conn_dict, fd,



Home | Main Index | Thread Index | Old Index