From: Emil Velikov Date: Mon, 10 Feb 2014 20:08:31 +0000 (+0000) Subject: pipe-loader: handle memory allocation failure X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b4e8572bca60928c297e2b913ea1059aef104b98;p=mesa.git pipe-loader: handle memory allocation failure Signed-off-by: Emil Velikov Reviewed-by: Jakob Bornecrantz --- diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c index 9b8f1b55e8f..b8acbb91e53 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 fd3d9894193..7f3f93befff 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";