Skip to content

Potential Missing Release of File Descriptor or Handle after Effective Lifetime. #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MicroMilo opened this issue Mar 4, 2025 · 1 comment
Assignees

Comments

@MicroMilo
Copy link

Hi, developers of scip, I run a SAST to detect a potential Missing Release of File Descriptor or Handle after Effective Lifetime in examples/LOP/src/genRandomLOPInstance.c#L106

here is the source code starting from line 106.

   file = fopen(argv[1], "w");
   if ( file == NULL )
   {
      printf("Could not open file %s.\n", argv[1]);
      return 1;
   }

   /* write comment line and size*/
   fprintf(file, "Randomly generated LOP instance.\n");
   fprintf(file, "%d\n", n);
   for (i = 0; i < n; ++i)
   {
      for (j = 0; j < n; ++j)
	 fprintf(file, "%d ", getRandomInt(0, d, &seed));
      fprintf(file, "\n");
   }

   printf("Wrote random LOP instance to %s\n", argv[1]);
   printf("Size: %d\n", n);
   printf("Entries: {0, ..., %d}\n", d);

   return 0;
}
@svigerske svigerske self-assigned this Mar 4, 2025
@svigerske
Copy link
Member

Yes, explicitly closing the file wouldn't harm. Will add this soon.

@scip-ci scip-ci closed this as completed in d6da63b Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants