mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
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 <davidagilbert@uk.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
bd60324706
commit
031380d877
3 changed files with 28 additions and 28 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue