提交 0b223371 编写于 作者: M Mark Adler

Avoid use of reallocf() in test/infcover.c.

上级 0db8fd37
...@@ -237,14 +237,14 @@ local void mem_done(z_stream *strm, char *prefix) ...@@ -237,14 +237,14 @@ local void mem_done(z_stream *strm, char *prefix)
/* Decode a hexadecimal string, set *len to length, in[] to the bytes. This /* Decode a hexadecimal string, set *len to length, in[] to the bytes. This
decodes liberally, in that hex digits can be adjacent, in which case two in decodes liberally, in that hex digits can be adjacent, in which case two in
a row writes a byte. Or they can delimited by any non-hex character, where a row writes a byte. Or they can be delimited by any non-hex character,
the delimiters are ignored except when a single hex digit is followed by a where the delimiters are ignored except when a single hex digit is followed
delimiter in which case that single digit writes a byte. The returned by a delimiter, where that single digit writes a byte. The returned data is
data is allocated and must eventually be freed. NULL is returned if out of allocated and must eventually be freed. NULL is returned if out of memory.
memory. If the length is not needed, then len can be NULL. */ If the length is not needed, then len can be NULL. */
local unsigned char *h2b(const char *hex, unsigned *len) local unsigned char *h2b(const char *hex, unsigned *len)
{ {
unsigned char *in; unsigned char *in, *re;
unsigned next, val; unsigned next, val;
in = malloc((strlen(hex) + 1) >> 1); in = malloc((strlen(hex) + 1) >> 1);
...@@ -268,8 +268,8 @@ local unsigned char *h2b(const char *hex, unsigned *len) ...@@ -268,8 +268,8 @@ local unsigned char *h2b(const char *hex, unsigned *len)
} while (*hex++); /* go through the loop with the terminating null */ } while (*hex++); /* go through the loop with the terminating null */
if (len != NULL) if (len != NULL)
*len = next; *len = next;
in = reallocf(in, next); re = realloc(in, next);
return in; return re == NULL ? in : re;
} }
/* generic inflate() run, where hex is the hexadecimal input data, what is the /* generic inflate() run, where hex is the hexadecimal input data, what is the
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册