str_close_leak.c 314 B

1234567891011121314151617
  1. #include <fcntl.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <unistd.h>
  5. int main(int argc, char** argv) {
  6. for (int i = 0; i < 1000000; i++) {
  7. int fd = open("/proc/meminfo", O_RDONLY);
  8. if (fd == -1)
  9. abort();
  10. close(fd);
  11. }
  12. printf("Success\n");
  13. return 0;
  14. }