2003-06-10 Phil Torre <ptorre@zetron.com>

PR 411/filesystem
	* src/imfs/imfs_unlink.c: Fix bug where renaming a memfile and
	then unlinking it causes a memory leak.
This commit is contained in:
Joel Sherrill
2003-06-10 17:32:04 +00:00
parent a699864a4f
commit e8ee071750
2 changed files with 16 additions and 6 deletions

View File

@@ -1,3 +1,9 @@
2003-06-10 Phil Torre <ptorre@zetron.com>
PR 411/filesystem
* src/imfs/imfs_unlink.c: Fix bug where renaming a memfile and
then unlinking it causes a memory leak.
2003-03-25 Thomas Doerfler <Thomas.Doerfler@imd-systems.de>
PR 367/filesystem

View File

@@ -58,12 +58,16 @@ int IMFS_unlink(
* to remove the node that is a link and the node itself.
*/
node->info.hard_link.link_node->st_nlink --;
IMFS_update_ctime( node->info.hard_link.link_node );
if ( node->info.hard_link.link_node->st_nlink < 1) {
result = (*the_link.handlers->rmnod_h)( &the_link );
if ( result != 0 )
return -1;
if ( node->info.hard_link.link_node->st_nlink == 1)
{
result = (*the_link.handlers->rmnod_h)( &the_link );
if ( result != 0 )
return -1;
}
else
{
node->info.hard_link.link_node->st_nlink --;
IMFS_update_ctime( node->info.hard_link.link_node );
}
}