Skip to content
  • Wenwen Wang's avatar
    firestream: fix memory leaks · fa865ba1
    Wenwen Wang authored
    
    
    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: default avatarWenwen Wang <wenwen@cs.uga.edu>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    fa865ba1