IMFS: Fix resource leak

This commit is contained in:
Sebastian Huber
2015-02-06 20:50:49 +01:00
parent 60cf8a5c16
commit 11026956c6

View File

@@ -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;
}