diff options
author | Colin Watson <cjwatson@debian.org> | 2020-02-21 11:57:14 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2020-02-21 11:57:14 +0000 |
commit | f0de78bd4f29fa688c5df116f3f9cd43543a76d0 (patch) | |
tree | 856b0dee3f2764c13a32dad5ffe2424fab7fef41 /xmalloc.c | |
parent | 4213eec74e74de6310c27a40c3e9759a08a73996 (diff) | |
parent | 8aa3455b16fddea4c0144a7c4a1edb10ec67dcc8 (diff) |
Import openssh_8.2p1.orig.tar.gz
Diffstat (limited to 'xmalloc.c')
-rw-r--r-- | xmalloc.c | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: xmalloc.c,v 1.35 2019/06/06 05:13:13 otto Exp $ */ | 1 | /* $OpenBSD: xmalloc.c,v 1.36 2019/11/12 22:32:48 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -96,17 +96,24 @@ xstrdup(const char *str) | |||
96 | } | 96 | } |
97 | 97 | ||
98 | int | 98 | int |
99 | xvasprintf(char **ret, const char *fmt, va_list ap) | ||
100 | { | ||
101 | int i; | ||
102 | |||
103 | i = vasprintf(ret, fmt, ap); | ||
104 | if (i < 0 || *ret == NULL) | ||
105 | fatal("xvasprintf: could not allocate memory"); | ||
106 | return i; | ||
107 | } | ||
108 | |||
109 | int | ||
99 | xasprintf(char **ret, const char *fmt, ...) | 110 | xasprintf(char **ret, const char *fmt, ...) |
100 | { | 111 | { |
101 | va_list ap; | 112 | va_list ap; |
102 | int i; | 113 | int i; |
103 | 114 | ||
104 | va_start(ap, fmt); | 115 | va_start(ap, fmt); |
105 | i = vasprintf(ret, fmt, ap); | 116 | i = xvasprintf(ret, fmt, ap); |
106 | va_end(ap); | 117 | va_end(ap); |
107 | 118 | return i; | |
108 | if (i < 0 || *ret == NULL) | ||
109 | fatal("xasprintf: could not allocate memory"); | ||
110 | |||
111 | return (i); | ||
112 | } | 119 | } |