---
src/xen/xm_internal.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 27cc387..6503d89 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -1503,7 +1503,8 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
for (i = 0 ; i < def->nnets ; i++) {
if (!memcmp(def->nets[i]->mac,
dev->data.net->mac,
- sizeof(def->nets[i]->mac))) {
+ sizeof(def->nets[i]->mac)) ||
+ ((def->nnets == 1) && dev->data.net->mac_generated)) {
virDomainNetDefFree(def->nets[i]);
if (i < (def->nnets - 1))
memmove(def->nets + i,
--
1.7.4