diff options
author | Emil Velikov <emil.l.velikov@gmail.com> | 2014-02-10 20:08:31 +0000 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2014-02-22 03:26:28 +0000 |
commit | b4e8572bca60928c297e2b913ea1059aef104b98 (patch) | |
tree | 3d8b41cd28bacc01d0648a020146e49e6a791ca3 /src | |
parent | 1fb750f7f7331f369acf1827c79dc5e8d4e5ec42 (diff) | |
download | external_mesa3d-b4e8572bca60928c297e2b913ea1059aef104b98.zip external_mesa3d-b4e8572bca60928c297e2b913ea1059aef104b98.tar.gz external_mesa3d-b4e8572bca60928c297e2b913ea1059aef104b98.tar.bz2 |
pipe-loader: handle memory allocation failure
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c index 9b8f1b5..b8acbb9 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c @@ -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; diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c index fd3d989..7f3f93b 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c @@ -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"; |