Fork us on GitHub Follow us on Facebook Follow us on Twitter

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/driver.c

    r8a637a4 r669e9b5  
    121121        devman_handle_t parent_fun_handle = IPC_GET_ARG2(*icall);
    122122       
    123         ddf_dev_t *dev = create_device();
    124        
    125         /* Add one reference that will be dropped by driver_dev_remove() */
    126         dev_add_ref(dev);
    127         dev->handle = dev_handle;
    128        
    129123        char *dev_name = NULL;
    130124        int rc = async_data_write_accept((void **) &dev_name, true, 0, 0, 0, 0);
     
    133127                return;
    134128        }
    135        
     129
     130        ddf_dev_t *dev = create_device();
     131        if (!dev) {
     132                free(dev_name);
     133                async_answer_0(iid, ENOMEM);
     134                return;
     135        }
     136
     137        /* Add one reference that will be dropped by driver_dev_remove() */
     138        dev_add_ref(dev);
     139        dev->handle = dev_handle;
    136140        dev->name = dev_name;
    137141       
     
    495499        if (dev->driver_data != NULL)
    496500                free(dev->driver_data);
     501        if (dev->name)
     502                free(dev->name);
    497503        free(dev);
    498504}
Note: See TracChangeset for help on using the changeset viewer.