daemon: Close leaked file descriptor along checksum error path (RHBZ#657499).
authorRichard W.M. Jones <rjones@redhat.com>
Fri, 26 Nov 2010 10:18:29 +0000 (10:18 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Fri, 26 Nov 2010 10:18:29 +0000 (10:18 +0000)
daemon/checksum.c

index 7967f0c..cdb0a18 100644 (file)
@@ -61,8 +61,10 @@ checksum (const char *csumtype, int fd)
   int len;
 
   program = program_of_csum (csumtype);
-  if (program == NULL)
+  if (program == NULL) {
+    close (fd);
     return NULL;
+  }
 
   flags = COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN | fd;
   r = commandf (&out, &err, flags, program, NULL);