Browse Source

fix file leak

Eliminate excess reference count when associating fd with file.

Fixes #258
pull/261/head
Andrew Waterman 5 years ago
parent
commit
387e54a580
  1. 2
      pk/syscall.c

2
pk/syscall.c

@ -145,8 +145,8 @@ int sys_openat(int dirfd, const char* name, int flags, int mode)
return PTR_ERR(file);
int fd = file_dup(file);
file_decref(file); // counteract file_dup's file_incref
if (fd < 0) {
file_decref(file);
return -ENOMEM;
}

Loading…
Cancel
Save