From 12333d665075b5a1042bac3916ed0df00e549266 Mon Sep 17 00:00:00 2001
From: Ben Pfaff <blp@nicira.com>
Date: Wed, 26 Nov 2008 16:07:56 -0800
Subject: [PATCH] Make dpif_close() accept a null pointer.

It's customary for destructor functions to accept and ignore null pointers.

This commit does not fix any known bug.
---
 lib/dpif.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/dpif.c b/lib/dpif.c
index 5739e18aa..6407490de 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -103,7 +103,9 @@ dpif_open(int dp_idx, bool subscribe, struct dpif *dp)
 void
 dpif_close(struct dpif *dp) 
 {
-    nl_sock_destroy(dp->sock);
+    if (dp) {
+        nl_sock_destroy(dp->sock);
+    }
 }
 
 static const struct nl_policy openflow_policy[] = {
-- 
2.47.0