Bug #1810: Fix oned crash when calling attachdisk with an improperly formated DISK template

Signed-off-by: Simon Boulet <simon@nostalgeek.com>
(cherry picked from commit 60b47c7183)
This commit is contained in:
Simon Boulet authored and Carlos Martín committed 2013-03-12 16:32:39 +01:00
1 parent f562940532
commit 5031df5ade
2 files changed
+10 -2

No files matched your search

+1 -1
View File
@@ -355,7 +355,7 @@ public:
/**
* Clones the current attribute
*/
Attribute* clone() const
VectorAttribute* clone() const
{
return new VectorAttribute(*this);
};
+9 -1
View File
@@ -1260,7 +1260,15 @@ VectorAttribute * VirtualMachine::set_up_attach_disk(
return 0;
}
new_disk = new VectorAttribute(*(dynamic_cast<VectorAttribute * >(disks[0])));
new_disk = dynamic_cast<VectorAttribute * >(disks[0]);
if ( new_disk == 0 )
{
error_str = "Internal error parsing DISK attribute";
return 0;
}
new_disk = new_disk->clone();
// -------------------------------------------------------------------------
// Acquire the new disk image