1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-28 14:50:08 +03:00

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

Signed-off-by: Simon Boulet <simon@nostalgeek.com>
This commit is contained in:
Simon Boulet 2013-03-11 20:08:44 -04:00 committed by Carlos Martín
parent 8276e4defc
commit 60b47c7183
2 changed files with 10 additions and 2 deletions

View File

@ -393,7 +393,7 @@ public:
/**
* Clones the current attribute
*/
Attribute* clone() const
VectorAttribute* clone() const
{
return new VectorAttribute(*this);
};

View File

@ -1686,7 +1686,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