aboutsummaryrefslogtreecommitdiff
path: root/qemu-char.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-02-05 22:06:18 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-02-05 22:06:18 +0000
commit1eec614b36390be66430ed6dd0ce47a6f2f0ae1a (patch)
treefa9174028d54ea9a531a77d05996688fc704fadd /qemu-char.c
parent0d0266a53b4c80ab08c093c36bb3a7bbb29cc3e5 (diff)
downloadqemu-1eec614b36390be66430ed6dd0ce47a6f2f0ae1a.zip
qemu-1eec614b36390be66430ed6dd0ce47a6f2f0ae1a.tar.gz
qemu-1eec614b36390be66430ed6dd0ce47a6f2f0ae1a.tar.bz2
toplevel: remove error handling from qemu_malloc() callers (Avi Kivity)
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6531 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/qemu-char.c b/qemu-char.c
index f849187..6e10c67 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -193,8 +193,6 @@ static CharDriverState *qemu_chr_open_null(void)
CharDriverState *chr;
chr = qemu_mallocz(sizeof(CharDriverState));
- if (!chr)
- return NULL;
chr->chr_write = null_chr_write;
return chr;
}
@@ -425,13 +423,7 @@ static CharDriverState *qemu_chr_open_mux(CharDriverState *drv)
MuxDriver *d;
chr = qemu_mallocz(sizeof(CharDriverState));
- if (!chr)
- return NULL;
d = qemu_mallocz(sizeof(MuxDriver));
- if (!d) {
- free(chr);
- return NULL;
- }
chr->opaque = d;
d->drv = drv;
@@ -576,13 +568,7 @@ static CharDriverState *qemu_chr_open_fd(int fd_in, int fd_out)
FDCharDriver *s;
chr = qemu_mallocz(sizeof(CharDriverState));
- if (!chr)
- return NULL;
s = qemu_mallocz(sizeof(FDCharDriver));
- if (!s) {
- free(chr);
- return NULL;
- }
s->fd_in = fd_in;
s->fd_out = fd_out;
chr->opaque = s;
@@ -929,13 +915,7 @@ static CharDriverState *qemu_chr_open_pty(void)
#endif
chr = qemu_mallocz(sizeof(CharDriverState));
- if (!chr)
- return NULL;
s = qemu_mallocz(sizeof(PtyCharDriver));
- if (!s) {
- qemu_free(chr);
- return NULL;
- }
if (openpty(&s->fd, &slave_fd, pty_name, NULL, NULL) < 0) {
return NULL;
@@ -1246,19 +1226,10 @@ static CharDriverState *qemu_chr_open_pp(const char *filename)
}
drv = qemu_mallocz(sizeof(ParallelCharDriver));
- if (!drv) {
- close(fd);
- return NULL;
- }
drv->fd = fd;
drv->mode = IEEE1284_MODE_COMPAT;
chr = qemu_mallocz(sizeof(CharDriverState));
- if (!chr) {
- qemu_free(drv);
- close(fd);
- return NULL;
- }
chr->chr_write = null_chr_write;
chr->chr_ioctl = pp_ioctl;
chr->chr_close = pp_close;
@@ -1318,10 +1289,6 @@ static CharDriverState *qemu_chr_open_pp(const char *filename)
return NULL;
chr = qemu_mallocz(sizeof(CharDriverState));
- if (!chr) {
- close(fd);
- return NULL;
- }
chr->opaque = (void *)fd;
chr->chr_write = null_chr_write;
chr->chr_ioctl = pp_ioctl;
@@ -1535,13 +1502,7 @@ static CharDriverState *qemu_chr_open_win(const char *filename)
WinCharState *s;
chr = qemu_mallocz(sizeof(CharDriverState));
- if (!chr)
- return NULL;
s = qemu_mallocz(sizeof(WinCharState));
- if (!s) {
- free(chr);
- return NULL;
- }
chr->opaque = s;
chr->chr_write = win_chr_write;
chr->chr_close = win_chr_close;
@@ -1640,13 +1601,7 @@ static CharDriverState *qemu_chr_open_win_pipe(const char *filename)
WinCharState *s;
chr = qemu_mallocz(sizeof(CharDriverState));
- if (!chr)
- return NULL;
s = qemu_mallocz(sizeof(WinCharState));
- if (!s) {
- free(chr);
- return NULL;
- }
chr->opaque = s;
chr->chr_write = win_chr_write;
chr->chr_close = win_chr_close;
@@ -1666,13 +1621,7 @@ static CharDriverState *qemu_chr_open_win_file(HANDLE fd_out)
WinCharState *s;
chr = qemu_mallocz(sizeof(CharDriverState));
- if (!chr)
- return NULL;
s = qemu_mallocz(sizeof(WinCharState));
- if (!s) {
- free(chr);
- return NULL;
- }
s->hcom = fd_out;
chr->opaque = s;
chr->chr_write = win_chr_write;
@@ -1774,11 +1723,7 @@ static CharDriverState *qemu_chr_open_udp(const char *def)
struct sockaddr_in saddr;
chr = qemu_mallocz(sizeof(CharDriverState));
- if (!chr)
- goto return_err;
s = qemu_mallocz(sizeof(NetCharDriver));
- if (!s)
- goto return_err;
fd = socket(PF_INET, SOCK_DGRAM, 0);
if (fd < 0) {
@@ -2044,11 +1989,7 @@ static CharDriverState *qemu_chr_open_tcp(const char *host_str,
is_waitconnect = 0;
chr = qemu_mallocz(sizeof(CharDriverState));
- if (!chr)
- goto fail;
s = qemu_mallocz(sizeof(TCPCharDriver));
- if (!s)
- goto fail;
if (is_listen) {
chr->filename = qemu_malloc(256);