mirror of https://gitee.com/openkylin/libvirt.git
xenFormatXLDisk: Don't leak @target
==11260== 1,006 bytes in 1 blocks are definitely lost in loss record 106 of 111 ==11260== at 0x4C2AE5F: malloc (vg_replace_malloc.c:297) ==11260== by 0x4C2BDFF: realloc (vg_replace_malloc.c:693) ==11260== by 0x4EA430B: virReallocN (viralloc.c:245) ==11260== by 0x4EA7C52: virBufferGrow (virbuffer.c:130) ==11260== by 0x4EA7D28: virBufferAdd (virbuffer.c:165) ==11260== by 0x4EA8E10: virBufferStrcat (virbuffer.c:718) ==11260== by 0x42D263: xenFormatXLDiskSrcNet (xen_xl.c:960) ==11260== by 0x42D4EB: xenFormatXLDiskSrc (xen_xl.c:1015) ==11260== by 0x42D870: xenFormatXLDisk (xen_xl.c:1101) ==11260== by 0x42DA89: xenFormatXLDomainDisks (xen_xl.c:1148) ==11260== by 0x42EAF8: xenFormatXL (xen_xl.c:1558) ==11260== by 0x40E85F: testCompareParseXML (xlconfigtest.c:105) Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
48ad600916
commit
aaf0ac7e7c
|
@ -1034,6 +1034,7 @@ xenFormatXLDisk(virConfValuePtr list, virDomainDiskDefPtr disk)
|
||||||
int format = virDomainDiskGetFormat(disk);
|
int format = virDomainDiskGetFormat(disk);
|
||||||
const char *driver = virDomainDiskGetDriver(disk);
|
const char *driver = virDomainDiskGetDriver(disk);
|
||||||
char *target = NULL;
|
char *target = NULL;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
/* format */
|
/* format */
|
||||||
virBufferAddLit(&buf, "format=");
|
virBufferAddLit(&buf, "format=");
|
||||||
|
@ -1119,12 +1120,12 @@ xenFormatXLDisk(virConfValuePtr list, virDomainDiskDefPtr disk)
|
||||||
tmp->next = val;
|
tmp->next = val;
|
||||||
else
|
else
|
||||||
list->list = val;
|
list->list = val;
|
||||||
return 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(target);
|
VIR_FREE(target);
|
||||||
virBufferFreeAndReset(&buf);
|
virBufferFreeAndReset(&buf);
|
||||||
return -1;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue