summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2018-02-06 05:08:27 +0000
committerflorian <florian@openbsd.org>2018-02-06 05:08:27 +0000
commit2963b4362c2afb41e2cb3396dbe9921082abc3c0 (patch)
tree09bda02f52608f2e45d47cdcad978e1e04f72c68
parentkill dead code (diff)
downloadwireguard-openbsd-2963b4362c2afb41e2cb3396dbe9921082abc3c0.tar.xz
wireguard-openbsd-2963b4362c2afb41e2cb3396dbe9921082abc3c0.zip
move malloc check up so that it actually works.
OK benno
-rw-r--r--usr.sbin/acme-client/netproc.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.sbin/acme-client/netproc.c b/usr.sbin/acme-client/netproc.c
index 1c2f7f125c9..26033a3fc3c 100644
--- a/usr.sbin/acme-client/netproc.c
+++ b/usr.sbin/acme-client/netproc.c
@@ -1,4 +1,4 @@
-/* $Id: netproc.c,v 1.14 2017/11/27 01:58:52 florian Exp $ */
+/* $Id: netproc.c,v 1.15 2018/02/06 05:08:27 florian Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -209,12 +209,12 @@ nreq(struct conn *c, const char *addr)
free(c->buf.buf);
c->buf.sz = g->bodypartsz;
c->buf.buf = malloc(c->buf.sz);
- memcpy(c->buf.buf, g->bodypart, c->buf.sz);
- http_get_free(g);
if (c->buf.buf == NULL) {
warn("malloc");
- return -1;
- }
+ code = -1;
+ } else
+ memcpy(c->buf.buf, g->bodypart, c->buf.sz);
+ http_get_free(g);
return code;
}
@@ -310,12 +310,12 @@ sreq(struct conn *c, const char *addr, const char *req)
free(c->buf.buf);
c->buf.sz = g->bodypartsz;
c->buf.buf = malloc(c->buf.sz);
- memcpy(c->buf.buf, g->bodypart, c->buf.sz);
- http_get_free(g);
if (c->buf.buf == NULL) {
warn("malloc");
- return -1;
- }
+ code = -1;
+ } else
+ memcpy(c->buf.buf, g->bodypart, c->buf.sz);
+ http_get_free(g);
return code;
}