Browse Source

WPS UDF: Fix fd leak on error path

Signed-hostap: Jouni Malinen <j@w1.fi>
Jouni Malinen 12 years ago
parent
commit
19991e5fb2
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/wps/wps_ufd.c

+ 3 - 1
src/wps/wps_ufd.c

@@ -159,8 +159,10 @@ static void * init_ufd(struct wps_context *wps,
 	}
 
 	data = os_zalloc(sizeof(*data));
-	if (data == NULL)
+	if (data == NULL) {
+		close(ufd_fd);
 		return NULL;
+	}
 	data->ufd_fd = ufd_fd;
 	return data;
 }