soft links: Fix a memory leak by correcting a reference counting problem.

This commit is contained in:
Gregory Nutt 2017-02-05 15:14:16 -06:00
parent 8d961ee137
commit aefe32d33f

View File

@ -119,7 +119,8 @@ int link(FAR const char *path1, FAR const char *path2)
#ifndef CONFIG_DISABLE_MOUNTPOINT #ifndef CONFIG_DISABLE_MOUNTPOINT
/* Check if the inode is a mountpoint. */ /* Check if the inode is a mountpoint. */
if (INODE_IS_MOUNTPT(inode)) DEBUGASSERT(desc.node != NULL);
if (INODE_IS_MOUNTPT(desc.node))
{ {
/* Symbolic links within the mounted volume are not supported */ /* Symbolic links within the mounted volume are not supported */
@ -171,7 +172,6 @@ int link(FAR const char *path1, FAR const char *path2)
INODE_SET_SOFTLINK(inode); INODE_SET_SOFTLINK(inode);
inode->u.i_link = newpath2; inode->u.i_link = newpath2;
inode->i_crefs = 1;
} }
/* Symbolic link successfully created */ /* Symbolic link successfully created */