diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2010-11-13 16:29:05 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2010-11-13 16:29:05 +0000 |
commit | 30e8ed393ed48d9fe92fa1cc4510adfc045fa8ec (patch) | |
tree | 35e6498a8aade10d1e64077f4d4ef67d7f5d063c | |
parent | a6fc49ae082c6972a126cf255eb66343b0fc0243 (diff) |
Whoops, get the logic the right way round.
-rw-r--r-- | compat/imsg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compat/imsg.c b/compat/imsg.c index 6f56465d..71b0dde4 100644 --- a/compat/imsg.c +++ b/compat/imsg.c @@ -1,4 +1,4 @@ -/* $Id: imsg.c,v 1.6 2010-11-11 20:41:08 nicm Exp $ */ +/* $Id: imsg.c,v 1.7 2010-11-13 16:29:05 nicm Exp $ */ /* $OpenBSD: imsg.c,v 1.3 2010/05/26 13:56:07 nicm Exp $ */ /* @@ -111,7 +111,7 @@ imsg_get(struct imsgbuf *ibuf, struct imsg *imsg) return (0); datalen = imsg->hdr.len - IMSG_HEADER_SIZE; ibuf->r.rptr = ibuf->r.buf + IMSG_HEADER_SIZE; - if (datalen != 0 && (imsg->data = malloc(datalen + 1)) == NULL) + if ((imsg->data = malloc(datalen)) == NULL && datalen != 0) return (-1); if (imsg->hdr.flags & IMSGF_HASFD) |