Showing error 790

User: Jiri Slaby
Error type: Memory Leak
Error type description: There the code omits to free some allocated memory
File location: drivers/pcmcia/ds.c
Line in file: 235
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2011-11-07 22:26:27 UTC


Source:

 205        struct list_head                 node;
 206        struct pcmcia_device_id         id;
 207};
 208
 209/**
 210 * pcmcia_store_new_id - add a new PCMCIA device ID to this driver and re-probe devices
 211 * @driver: target device driver
 212 * @buf: buffer for scanning device ID data
 213 * @count: input size
 214 *
 215 * Adds a new dynamic PCMCIA device ID to this driver,
 216 * and causes the driver to probe for all devices again.
 217 */
 218static ssize_t
 219pcmcia_store_new_id(struct device_driver *driver, const char *buf, size_t count)
 220{
 221        struct pcmcia_dynid *dynid;
 222        struct pcmcia_driver *pdrv = to_pcmcia_drv(driver);
 223        __u16 match_flags, manf_id, card_id;
 224        __u8 func_id, function, device_no;
 225        __u32 prod_id_hash[4] = {0, 0, 0, 0};
 226        int fields=0;
 227        int retval = 0;
 228
 229        fields = sscanf(buf, "%hx %hx %hx %hhx %hhx %hhx %x %x %x %x",
 230                        &match_flags, &manf_id, &card_id, &func_id, &function, &device_no,
 231                        &prod_id_hash[0], &prod_id_hash[1], &prod_id_hash[2], &prod_id_hash[3]);
 232        if (fields < 6)
 233                return -EINVAL;
 234
 235        dynid = kzalloc(sizeof(struct pcmcia_dynid), GFP_KERNEL);
 236        if (!dynid)
 237                return -ENOMEM;
 238
 239        INIT_LIST_HEAD(&dynid->node);
 240        dynid->id.match_flags = match_flags;
 241        dynid->id.manf_id = manf_id;
 242        dynid->id.card_id = card_id;
 243        dynid->id.func_id = func_id;
 244        dynid->id.function = function;
 245        dynid->id.device_no = device_no;
Show full sources