pipe-loader: handle memory allocation failure
authorEmil Velikov <emil.l.velikov@gmail.com>
Mon, 10 Feb 2014 20:08:31 +0000 (20:08 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Sat, 22 Feb 2014 03:26:28 +0000 (03:26 +0000)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c

index 9b8f1b55e8fb990e02157a860e8e028f2a9bfc5d..b8acbb91e538c9eec7a48bd62d94055bed2e37aa 100644 (file)
@@ -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;
index fd3d98941931599466e6281feca7c99712dc40fb..7f3f93befffd9427227aac8fcf3a083f93652f9e 100644 (file)
@@ -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";