avoid use of vasnprintf in base/error.c
commit c94f299fc8
uses vasnprintf
which was previously removed from the libheimbase directory in
order to prevent a dependency on libroken.
Replace vasnprintf with snprintf and malloc to avoid the
dependency.
Change-Id: I029e7e6883406ca7311490a3dab4b65cad3ba70b
This commit is contained in:
11
base/error.c
11
base/error.c
@@ -92,12 +92,17 @@ heim_error_t
|
||||
heim_error_createv(int error_code, const char *fmt, va_list ap)
|
||||
{
|
||||
heim_error_t e;
|
||||
char *str = NULL;
|
||||
char *str;
|
||||
int len;
|
||||
|
||||
len = vasprintf(&str, fmt, ap);
|
||||
if (len < 0 || str == NULL)
|
||||
str = malloc(1024);
|
||||
if (str == NULL)
|
||||
return NULL;
|
||||
len = vsnprintf(str, 1024, fmt, ap);
|
||||
if (len < 0) {
|
||||
free(str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
e = _heim_alloc_object(&_heim_error_object, sizeof(struct heim_error));
|
||||
if (e) {
|
||||
|
Reference in New Issue
Block a user