summaryrefslogtreecommitdiff
path: root/block/nbd.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-08-20 22:09:37 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-20 23:01:08 -0500
commit7267c0947d7e8ae5dff7bafd932c3bc285f43e5c (patch)
tree9aa05d6e05ed83e67bf014f6745a3081b8407dc5 /block/nbd.c
parent14015304b662e8f8ccce46c5a6927af6a14c510b (diff)
downloadqemu-7267c0947d7e8ae5dff7bafd932c3bc285f43e5c.tar.gz
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'block/nbd.c')
-rw-r--r--block/nbd.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/block/nbd.c b/block/nbd.c
index 7a52f62e7e..55cb2fd8ba 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -65,7 +65,7 @@ static int nbd_config(BDRVNBDState *s, const char *filename, int flags)
const char *unixpath;
int err = -EINVAL;
- file = qemu_strdup(filename);
+ file = g_strdup(filename);
export_name = strstr(file, EN_OPTSTR);
if (export_name) {
@@ -74,7 +74,7 @@ static int nbd_config(BDRVNBDState *s, const char *filename, int flags)
}
export_name[0] = 0; /* truncate 'file' */
export_name += strlen(EN_OPTSTR);
- s->export_name = qemu_strdup(export_name);
+ s->export_name = g_strdup(export_name);
}
/* extract the host_spec - fail if it's not nbd:... */
@@ -87,18 +87,18 @@ static int nbd_config(BDRVNBDState *s, const char *filename, int flags)
if (unixpath[0] != '/') { /* We demand an absolute path*/
goto out;
}
- s->host_spec = qemu_strdup(unixpath);
+ s->host_spec = g_strdup(unixpath);
} else {
- s->host_spec = qemu_strdup(host_spec);
+ s->host_spec = g_strdup(host_spec);
}
err = 0;
out:
- qemu_free(file);
+ g_free(file);
if (err != 0) {
- qemu_free(s->export_name);
- qemu_free(s->host_spec);
+ g_free(s->export_name);
+ g_free(s->host_spec);
}
return err;
}
@@ -240,8 +240,8 @@ static int nbd_write(BlockDriverState *bs, int64_t sector_num,
static void nbd_close(BlockDriverState *bs)
{
BDRVNBDState *s = bs->opaque;
- qemu_free(s->export_name);
- qemu_free(s->host_spec);
+ g_free(s->export_name);
+ g_free(s->host_spec);
nbd_teardown_connection(bs);
}