util: Make it possible for virResctrlAllocSetMask to replace existing mask

This wil be used in the future, but it makes sense for now as well.  It makes
sure there is no mask leftover that would leak.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2018-01-26 14:47:19 +01:00
parent ebafc603c1
commit 6899118043

View File

@ -1239,6 +1239,7 @@ virResctrlAllocSetMask(virResctrlAllocPerTypePtr a_type,
cache - a_type->nmasks + 1) < 0) cache - a_type->nmasks + 1) < 0)
return -1; return -1;
virBitmapFree(a_type->masks[cache]);
a_type->masks[cache] = mask; a_type->masks[cache] = mask;
return 0; return 0;