Showing error 799

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


Source:

 113                    if (KVAL(v) > max_vals[KTYP(v)])
 114                                return -EINVAL;
 115                } else
 116                    if (kbd->kbdmode != VC_UNICODE)
 117                                return -EINVAL;
 118
 119                /* ++Geert: non-PC keyboards may generate keycode zero */
 120#if !defined(__mc68000__) && !defined(__powerpc__)
 121                /* assignment to entry 0 only tests validity of args */
 122                if (!i)
 123                        break;
 124#endif
 125
 126                if (!(key_map = key_maps[s])) {
 127                        int j;
 128
 129                        if (keymap_count >= MAX_NR_OF_USER_KEYMAPS &&
 130                            !capable(CAP_SYS_RESOURCE))
 131                                return -EPERM;
 132
 133                        key_map = kmalloc(sizeof(plain_map),
 134                                                     GFP_KERNEL);
 135                        if (!key_map)
 136                                return -ENOMEM;
 137                        key_maps[s] = key_map;
 138                        key_map[0] = U(K_ALLOCATED);
 139                        for (j = 1; j < NR_KEYS; j++)
 140                                key_map[j] = U(K_HOLE);
 141                        keymap_count++;
 142                }
 143                ov = U(key_map[i]);
 144                if (v == ov)
 145                        break;        /* nothing to do */
 146                /*
 147                 * Attention Key.
 148                 */
 149                if (((ov == K_SAK) || (v == K_SAK)) && !capable(CAP_SYS_ADMIN))
 150                        return -EPERM;
 151                key_map[i] = U(v);
 152                if (!s && (KTYP(ov) == KT_SHIFT || KTYP(v) == KT_SHIFT))
 153                        compute_shiftstate();
Show full sources