on failure set hex_encode output to NULL

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24121 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2008-12-11 05:03:17 +00:00
parent 91f2ef3f76
commit c9122e8b28

View File

@@ -64,8 +64,10 @@ hex_encode(const void *data, size_t size, char **str)
return -1;
p = malloc(size * 2 + 1);
if (p == NULL)
if (p == NULL) {
*str = NULL;
return -1;
}
for (i = 0; i < size; i++) {
p[i * 2] = hexchar[(*q >> 4) & 0xf];