Skip to content

Commit b9b2cc1

Browse files
Fix memory leak in glfs_h_create_from_handle
If the allocation of the glfs_object failed, the reference to the newly found or linked inode was leaked. We introduce a call to inode_unref(newinode) guarded by a check, so that the newinode does not leak in such case. # api/src/glfs-handleops.c | 2 ++ # 1 file changed, 2 insertions(+)
1 parent ae1d696 commit b9b2cc1

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

api/src/glfs-handleops.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,8 @@ pub_glfs_h_create_from_handle(struct glfs *fs, unsigned char *handle, int len,
15021502
if (object == NULL) {
15031503
errno = ENOMEM;
15041504
ret = -1;
1505+
if (newinode)
1506+
inode_unref(newinode);
15051507
goto out;
15061508
}
15071509

0 commit comments

Comments
 (0)