dpif: Fix fd leak in dpif_create().
authorBen Pfaff <blp@nicira.com>
Wed, 11 Mar 2009 21:32:24 +0000 (14:32 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 11 Mar 2009 21:44:57 +0000 (14:44 -0700)
lib/dpif.c

index c179fbda10ed00f1edd632baf03b841a61afa01d..0109cda466a98110113cc10ad8eb8804b4a85198 100644 (file)
@@ -176,8 +176,9 @@ dpif_create(const char *name, struct dpif *dpif)
             error = ioctl(dpif->fd, ODP_DP_CREATE, name) < 0 ? errno : 0;
             if (!error) {
                 return 0;
-            } else if (error != EBUSY) {
-                dpif_close(dpif);
+            }
+            dpif_close(dpif);
+            if (error != EBUSY) {
                 return error;
             }
         }