Revision 7267c094 block/nbd.c
b/block/nbd.c | ||
---|---|---|
65 | 65 |
const char *unixpath; |
66 | 66 |
int err = -EINVAL; |
67 | 67 |
|
68 |
file = qemu_strdup(filename);
|
|
68 |
file = g_strdup(filename);
|
|
69 | 69 |
|
70 | 70 |
export_name = strstr(file, EN_OPTSTR); |
71 | 71 |
if (export_name) { |
... | ... | |
74 | 74 |
} |
75 | 75 |
export_name[0] = 0; /* truncate 'file' */ |
76 | 76 |
export_name += strlen(EN_OPTSTR); |
77 |
s->export_name = qemu_strdup(export_name);
|
|
77 |
s->export_name = g_strdup(export_name);
|
|
78 | 78 |
} |
79 | 79 |
|
80 | 80 |
/* extract the host_spec - fail if it's not nbd:... */ |
... | ... | |
87 | 87 |
if (unixpath[0] != '/') { /* We demand an absolute path*/ |
88 | 88 |
goto out; |
89 | 89 |
} |
90 |
s->host_spec = qemu_strdup(unixpath);
|
|
90 |
s->host_spec = g_strdup(unixpath);
|
|
91 | 91 |
} else { |
92 |
s->host_spec = qemu_strdup(host_spec);
|
|
92 |
s->host_spec = g_strdup(host_spec);
|
|
93 | 93 |
} |
94 | 94 |
|
95 | 95 |
err = 0; |
96 | 96 |
|
97 | 97 |
out: |
98 |
qemu_free(file);
|
|
98 |
g_free(file);
|
|
99 | 99 |
if (err != 0) { |
100 |
qemu_free(s->export_name);
|
|
101 |
qemu_free(s->host_spec);
|
|
100 |
g_free(s->export_name);
|
|
101 |
g_free(s->host_spec);
|
|
102 | 102 |
} |
103 | 103 |
return err; |
104 | 104 |
} |
... | ... | |
240 | 240 |
static void nbd_close(BlockDriverState *bs) |
241 | 241 |
{ |
242 | 242 |
BDRVNBDState *s = bs->opaque; |
243 |
qemu_free(s->export_name);
|
|
244 |
qemu_free(s->host_spec);
|
|
243 |
g_free(s->export_name);
|
|
244 |
g_free(s->host_spec);
|
|
245 | 245 |
|
246 | 246 |
nbd_teardown_connection(bs); |
247 | 247 |
} |
Also available in: Unified diff