User: | Jiri Slaby |
Error type: | Memory Leak |
Error type description: | There the code omits to free some allocated memory |
File location: | drivers/uwb/neh.c |
Line in file: | 391 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Stanse
(1.2)
|
Entered: | 2011-11-07 22:26:27 UTC |
361 * that calls back this function for every received notification; this 362 * function then will rearm itself). 363 * 364 * Notification data buffers are dynamically allocated by the NEH 365 * handling code in neh.c [uwb_rc_neh_lookup()]. What is actually 366 * allocated is space to contain the notification data. 367 * 368 * Buffers are prefixed with a Radio Control Event Block (RCEB) as 369 * defined by the WUSB Wired-Adapter Radio Control interface. We 370 * just use it for the notification code. 371 * 372 * On each case statement we just transcode endianess of the different 373 * fields. We declare a pointer to a RCI definition of an event, and 374 * then to a UWB definition of the same event (which are the same, 375 * remember). Event if we use different pointers 376 */ 377static 378void uwb_rc_notif(struct uwb_rc *rc, struct uwb_rceb *rceb, ssize_t size) 379{ 380 struct device *dev = &rc->uwb_dev.dev; 381 struct uwb_event *uwb_evt; 382 383 if (size == -ESHUTDOWN) 384 return; 385 if (size < 0) { 386 dev_err(dev, "ignoring event with error code %zu\n", 387 size); 388 return; 389 } 390 391 uwb_evt = kzalloc(sizeof(*uwb_evt), GFP_ATOMIC); 392 if (unlikely(uwb_evt == NULL)) { 393 dev_err(dev, "no memory to queue event 0x%02x/%04x/%02x\n", 394 rceb->bEventType, le16_to_cpu(rceb->wEvent), 395 rceb->bEventContext); 396 return; 397 } 398 uwb_evt->rc = __uwb_rc_get(rc); /* will be put by uwbd's uwbd_event_handle() */ 399 uwb_evt->ts_jiffies = jiffies; 400 uwb_evt->type = UWB_EVT_TYPE_NOTIF; 401 uwb_evt->notif.size = size;