if (walk == dev) break;
}
+ /* This function may be called twice for the same device if a
+ libparted user explictly removes the device from the cache using
+ ped_device_cache_remove(), we get called and it then becomes the
+ user's responsibility to free the PedDevice by calling
+ ped_device_destroy().
+ ped_device_destroy() will then call us a second time, so if the
+ device is not found in the list do nothing. */
+ if (walk == NULL)
+ return;
+
if (last)
last->next = dev->next;
else