From 031380d8770d2df6c386e4aeabd412007d3ebd54 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Mon, 16 Jan 2012 09:28:06 +0000 Subject: block: replace unchecked strdup/malloc/calloc with glib Most of the codebase as been converted to use glib memory allocation functions. There are still a few instances of malloc/calloc in the block layer and qemu-io. Replace them, especially since they do not check the strdup/malloc/calloc return value. Reported-by: Dr David Alan Gilbert Signed-off-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block/blkverify.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'block/blkverify.c') diff --git a/block/blkverify.c b/block/blkverify.c index 4ca8584b88..9d5f1ec5b9 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -87,10 +87,10 @@ static int blkverify_open(BlockDriverState *bs, const char *filename, int flags) return -EINVAL; } - raw = strdup(filename); + raw = g_strdup(filename); raw[c - filename] = '\0'; ret = bdrv_file_open(&bs->file, raw, flags); - free(raw); + g_free(raw); if (ret < 0) { return ret; } -- cgit v1.2.1