[PATCH] Fix double free in error path
authorJens Axboe <jens.axboe@oracle.com>
Tue, 2 Jan 2007 08:20:49 +0000 (09:20 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 2 Jan 2007 08:20:49 +0000 (09:20 +0100)
Reported by zhuxudong <zhuxudong@nrchpc.ac.cn>

If we fail reading, we will free the realloc'ed pointer and jump to
the error path which will free the original pointer. Fix this by clearing
the original pointer.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
blkparse.c

index 6bb53080cedb1ec53b477507c1352c6fc6c29e1b..90614d81cf9efbd504daae660daea1ce6d734cdf 100644 (file)
@@ -2167,6 +2167,7 @@ static int ms_prime(struct ms_stream *msp)
                                                             1, &pci->fdblock);
                        if (ret) {
                                free(ptr);
+                               bit = NULL;
                                goto err;
                        }