forked from Imagelibrary/rtems
IMFS: Fix resource leak
This commit is contained in:
@@ -119,7 +119,7 @@ static IMFS_jnode_t *IMFS_node_remove_hard_link(
|
||||
|
||||
_Assert( target != NULL );
|
||||
|
||||
if ( target->st_nlink == 1) {
|
||||
if ( target->st_nlink == 1 ) {
|
||||
target = (*target->control->node_remove)( target );
|
||||
if ( target == NULL ) {
|
||||
node = NULL;
|
||||
@@ -129,6 +129,14 @@ static IMFS_jnode_t *IMFS_node_remove_hard_link(
|
||||
IMFS_update_ctime( target );
|
||||
}
|
||||
|
||||
if ( target != NULL ) {
|
||||
--target->reference_count;
|
||||
|
||||
if ( target->reference_count == 0 ) {
|
||||
IMFS_node_destroy( target );
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user