Commit fa865ba
firestream: fix memory leaks
In fs_open(), 'vcc' is allocated through kmalloc() and assigned to
'atm_vcc->dev_data.' In the following execution, if an error occurs, e.g.,
there is no more free channel, an error code EBUSY or ENOMEM will be
returned. However, 'vcc' is not deallocated, leading to memory leaks. Note
that, in normal cases where fs_open() returns 0, 'vcc' will be deallocated
in fs_close(). But, if fs_open() fails, there is no guarantee that
fs_close() will be invoked.
To fix this issue, deallocate 'vcc' before the error code is returned.
Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>1 parent 6badad1 commit fa865ba
1 file changed
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
912 | 912 | | |
913 | 913 | | |
914 | 914 | | |
| 915 | + | |
915 | 916 | | |
916 | 917 | | |
917 | 918 | | |
| |||
922 | 923 | | |
923 | 924 | | |
924 | 925 | | |
| 926 | + | |
925 | 927 | | |
926 | 928 | | |
927 | 929 | | |
| |||
935 | 937 | | |
936 | 938 | | |
937 | 939 | | |
| 940 | + | |
938 | 941 | | |
939 | 942 | | |
940 | 943 | | |
| |||
0 commit comments