pipe-loader: handle memory allocation failure

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
This commit is contained in:
Emil Velikov
2014-02-10 20:08:31 +00:00
parent 1fb750f7f7
commit b4e8572bca
2 changed files with 4 additions and 0 deletions
@@ -123,6 +123,9 @@ pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd,
struct pipe_loader_drm_device *ddev = CALLOC_STRUCT(pipe_loader_drm_device);
int vendor_id, chip_id;
if (!ddev)
return FALSE;
if (loader_get_pci_id_for_fd(fd, &vendor_id, &chip_id)) {
ddev->base.type = PIPE_LOADER_DEVICE_PCI;
ddev->base.u.pci.vendor_id = vendor_id;
@@ -58,6 +58,7 @@ pipe_loader_sw_probe(struct pipe_loader_device **devs, int ndev)
for (i = 0; i < Elements(backends); i++) {
if (i < ndev) {
struct pipe_loader_sw_device *sdev = CALLOC_STRUCT(pipe_loader_sw_device);
/* TODO: handle CALLOC_STRUCT failure */
sdev->base.type = PIPE_LOADER_DEVICE_SOFTWARE;
sdev->base.driver_name = "swrast";