Make dpif_close() accept a null pointer.
authorBen Pfaff <blp@nicira.com>
Thu, 27 Nov 2008 00:07:56 +0000 (16:07 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 27 Nov 2008 06:25:39 +0000 (22:25 -0800)
It's customary for destructor functions to accept and ignore null pointers.

This commit does not fix any known bug.

lib/dpif.c

index 5739e18..6407490 100644 (file)
@@ -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[] = {