Fix fifo leak
authorJens Axboe <jens.axboe@oracle.com>
Wed, 16 May 2007 07:26:23 +0000 (09:26 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 16 May 2007 07:26:23 +0000 (09:26 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
blktrace.c
fifo.h

index fc98091868566531b6cc2a3069d5d5c38c79a20b..698d16ff11949482d1099283db5a06b7cc2bde67 100644 (file)
@@ -227,6 +227,7 @@ int load_blktrace(struct thread_data *td, const char *filename)
                cpu = t.cpu;
        } while (1);
 
                cpu = t.cpu;
        } while (1);
 
+       fifo_free(fifo);
        close(fd);
 
        if (!ios[DDIR_READ] && !ios[DDIR_WRITE]) {
        close(fd);
 
        if (!ios[DDIR_READ] && !ios[DDIR_WRITE]) {
@@ -253,5 +254,6 @@ int load_blktrace(struct thread_data *td, const char *filename)
        return 0;
 err:
        close(fd);
        return 0;
 err:
        close(fd);
+       fifo_free(fifo);
        return 1;
 }
        return 1;
 }
diff --git a/fifo.h b/fifo.h
index 6a9115d48e4561702325b1921da191444b95f9eb..cfacea996f0309b323b93b67a79f1b89d555dd2b 100644 (file)
--- a/fifo.h
+++ b/fifo.h
@@ -28,6 +28,7 @@ struct fifo {
 struct fifo *fifo_alloc(unsigned int);
 unsigned int fifo_put(struct fifo *, void *, unsigned int);
 unsigned int fifo_get(struct fifo *, void *, unsigned int);
 struct fifo *fifo_alloc(unsigned int);
 unsigned int fifo_put(struct fifo *, void *, unsigned int);
 unsigned int fifo_get(struct fifo *, void *, unsigned int);
+void fifo_free(struct fifo *);
 
 static inline unsigned int fifo_len(struct fifo *fifo)
 {
 
 static inline unsigned int fifo_len(struct fifo *fifo)
 {