libxlu: properly free buffer in PCI related functions

Free buffer in both success and failure paths.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
Wei Liu authored and Ian Campbell committed 2015-07-29 15:26:56 +01:00
1 parent 371e7eff4b
commit 4dcec65f7c
1 file changed
+6 -4
+6 -4
View File
@@ -167,17 +167,18 @@ int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str
}
}
free(buf2);
if ( tok != ptr || state != STATE_TERMINAL )
goto parse_error;
/* Just a pretty way to fill in the values */
pcidev_struct_fill(pcidev, dom, bus, dev, func, vslot << 3);
free(buf2);
return 0;
parse_error:
free(buf2);
return ERROR_INVAL;
}
@@ -246,14 +247,15 @@ int xlu_rdm_parse(XLU_Config *cfg, libxl_rdm_reserve *rdm, const char *str)
}
}
free(buf2);
if (tok != ptr || state != STATE_TERMINAL)
goto parse_error;
free(buf2);
return 0;
parse_error:
free(buf2);
return ERROR_INVAL;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.