chiark / gitweb /
udev_queue_get_seqnum_sequence_is_finished(): fix possible file handle leak
authorFlorian Zumbiehl <florz@florz.de>
Sun, 6 Sep 2009 15:28:26 +0000 (17:28 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Mon, 7 Sep 2009 10:13:50 +0000 (12:13 +0200)
libudev/libudev-queue.c

index 68efba0..f06c9e8 100644 (file)
@@ -360,10 +360,14 @@ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue,
                return 1;
        if (start < seqnum)
                start = seqnum;
                return 1;
        if (start < seqnum)
                start = seqnum;
-       if (start > end)
+       if (start > end) {
+               fclose(queue_file);
                return 1;
                return 1;
-       if (end - start > INT_MAX - 1)
+       }
+       if (end - start > INT_MAX - 1) {
+               fclose(queue_file);
                return -EOVERFLOW;
                return -EOVERFLOW;
+       }
        unfinished = (end - start) + 1;
 
        while (unfinished > 0) {
        unfinished = (end - start) + 1;
 
        while (unfinished > 0) {