Revision 7267c094 blockdev.c
b/blockdev.c | ||
---|---|---|
182 | 182 |
{ |
183 | 183 |
qemu_opts_del(dinfo->opts); |
184 | 184 |
bdrv_delete(dinfo->bdrv); |
185 |
qemu_free(dinfo->id);
|
|
185 |
g_free(dinfo->id);
|
|
186 | 186 |
QTAILQ_REMOVE(&drives, dinfo, next); |
187 |
qemu_free(dinfo);
|
|
187 |
g_free(dinfo);
|
|
188 | 188 |
} |
189 | 189 |
|
190 | 190 |
void drive_put_ref(DriveInfo *dinfo) |
... | ... | |
442 | 442 |
|
443 | 443 |
/* init */ |
444 | 444 |
|
445 |
dinfo = qemu_mallocz(sizeof(*dinfo));
|
|
445 |
dinfo = g_malloc0(sizeof(*dinfo));
|
|
446 | 446 |
if ((buf = qemu_opts_id(opts)) != NULL) { |
447 |
dinfo->id = qemu_strdup(buf);
|
|
447 |
dinfo->id = g_strdup(buf);
|
|
448 | 448 |
} else { |
449 | 449 |
/* no id supplied -> create one */ |
450 |
dinfo->id = qemu_mallocz(32);
|
|
450 |
dinfo->id = g_malloc0(32);
|
|
451 | 451 |
if (type == IF_IDE || type == IF_SCSI) |
452 | 452 |
mediastr = (media == MEDIA_CDROM) ? "-cd" : "-hd"; |
453 | 453 |
if (max_devs) |
... | ... | |
542 | 542 |
|
543 | 543 |
err: |
544 | 544 |
bdrv_delete(dinfo->bdrv); |
545 |
qemu_free(dinfo->id);
|
|
545 |
g_free(dinfo->id);
|
|
546 | 546 |
QTAILQ_REMOVE(&drives, dinfo, next); |
547 |
qemu_free(dinfo);
|
|
547 |
g_free(dinfo);
|
|
548 | 548 |
return NULL; |
549 | 549 |
} |
550 | 550 |
|
Also available in: Unified diff