Check for malloc(0) to make AIX happy

Prompted by [HEIMDAL-646] by Anton Lundin
This commit is contained in:
Love Hornquist Astrand
2009-09-24 07:32:35 -07:00
parent 98f2421134
commit 9bace01559
5 changed files with 17 additions and 4 deletions

View File

@@ -64,7 +64,7 @@ try(const struct example *c)
int ret;
size_t out_len = c->out_len;
uint32_t *tmp = malloc(out_len * sizeof(uint32_t));
if (tmp == NULL)
if (tmp == NULL && out_len != 0)
err(1, "malloc");
ret = _wind_stringprep_map(c->in, c->in_len, tmp, &out_len, WIND_PROFILE_NAME);
if (ret) {