]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
text-progress-bar: plug fd leak
authorJames Hunt <james.hunt@ubuntu.com>
Wed, 12 Oct 2011 02:03:08 +0000 (22:03 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 12 Oct 2011 02:03:08 +0000 (22:03 -0400)
This plugs a fd leak in an error path

src/libply-splash-core/ply-text-progress-bar.c

index 7ac02220b0e5f69866bc4f7c736a71b9710b4e58..faf84a4d7b9070fadc1247fca0f45933e050f5aa 100644 (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);