Skip to content

Commit

Permalink
Fix: check when the file could not be opened
Browse files Browse the repository at this point in the history
  • Loading branch information
RuffaloLavoisier committed Sep 23, 2024
1 parent 3a6c751 commit 0c6d368
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pluginlaunch.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,11 @@ get_available_memory ()
size_t len;

fd = fopen ("/proc/meminfo", "r");
if (fd == NULL)
{
g_warning ("Couldn't open /proc/meminfo");
return 0;
}
len = fread (buf, 1, sizeof (buf) - 1, fd);
fclose (fd);
if (len == 0)
Expand Down

0 comments on commit 0c6d368

Please sign in to comment.