
There's a loop to allocate and fill in a 'blist' array with entries that is then only saved for a specific domain type ("hvm"). If not hvm, then the blist is not freed (54) Event cond_false: Condition "strcasecmp(dominfo->os_info.fv.type, "hvm") == 0", taking false branch 1101 if (STREQC(dominfo->os_info.fv.type, "hvm")) { 1102 dominfo->os_info.fv.bootlist_ct = bl_size; 1103 dominfo->os_info.fv.bootlist = blist; (55) Event if_end: End of if statement 1104 } 1105 (56) Event leaked_storage: Variable "blist" going out of scope leaks the storage it points to. Resolve by adding code to free the memory --- libxkutil/device_parsing.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c index edd8bc4..436415a 100644 --- a/libxkutil/device_parsing.c +++ b/libxkutil/device_parsing.c @@ -1101,6 +1101,12 @@ static int parse_os(struct domain *dominfo, xmlNode *os) if (STREQC(dominfo->os_info.fv.type, "hvm")) { dominfo->os_info.fv.bootlist_ct = bl_size; dominfo->os_info.fv.bootlist = blist; + } else { + int i; + + for (i = 0; i < bl_size; i++) + free(blist[i]); + free(blist); } return 1; -- 1.8.1.4