Module Name:    src
Committed By:   christos
Date:           Sun Oct 13 20:35:52 UTC 2024

Modified Files:
        src/external/mpl/dhcp/dist/common: options.c

Log Message:
protect option_dereference like in the other cases (although the
option_dereference checks for it too).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/mpl/dhcp/dist/common/options.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mpl/dhcp/dist/common/options.c
diff -u src/external/mpl/dhcp/dist/common/options.c:1.7 src/external/mpl/dhcp/dist/common/options.c:1.8
--- src/external/mpl/dhcp/dist/common/options.c:1.7	Wed Oct  5 18:20:15 2022
+++ src/external/mpl/dhcp/dist/common/options.c	Sun Oct 13 16:35:52 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.7 2022/10/05 22:20:15 christos Exp $	*/
+/*	$NetBSD: options.c,v 1.8 2024/10/13 20:35:52 christos Exp $	*/
 
 /* options.c
 
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: options.c,v 1.7 2022/10/05 22:20:15 christos Exp $");
+__RCSID("$NetBSD: options.c,v 1.8 2024/10/13 20:35:52 christos Exp $");
 
 #define DHCP_OPTION_DATA
 #include "dhcpd.h"
@@ -235,7 +235,8 @@ int parse_option_buffer (options, buffer
 				log_error("parse_option_buffer: "
 					  "save_option_buffer failed");
 				buffer_dereference(&bp, MDL);
-				option_dereference(&option, MDL);
+				if (option)
+					option_dereference(&option, MDL);
 				return (0);
 			}
 		} else if (universe->concat_duplicates) {
@@ -247,7 +248,8 @@ int parse_option_buffer (options, buffer
 					     MDL)) {
 				log_error("parse_option_buffer: No memory.");
 				buffer_dereference(&bp, MDL);
-				option_dereference(&option, MDL);
+				if (option)
+					option_dereference(&option, MDL);
 				return (0);
 			}
 			/* Copy old option to new data object. */
@@ -272,7 +274,8 @@ int parse_option_buffer (options, buffer
 			if (!option_cache_allocate(&nop, MDL)) {
 				log_error("parse_option_buffer: No memory.");
 				buffer_dereference(&bp, MDL);
-				option_dereference(&option, MDL);
+				if (option)
+					option_dereference(&option, MDL);
 				return (0);
 			}
 

Reply via email to