text-progress-bar: plug fd leak

This plugs a fd leak in an error path
This commit is contained in:
James Hunt 2011-10-11 22:03:08 -04:00 committed by Ray Strode
parent 9fffcda4c5
commit bcb27226b7

View file

@ -106,8 +106,10 @@ get_os_string (void)
if (fd == -1)
return;
if (fstat (fd, &sbuf) == -1)
if (fstat (fd, &sbuf) == -1) {
close (fd);
return;
}
buf = calloc (sbuf.st_size + 1, sizeof(char));
read (fd, buf, sbuf.st_size);