Commit bc3919ab by Edward Thomson

global init: check error message buffer allocation

Ensure that we can allocate the error message buffer.  In keeping with
our typical policiess, we allow (small) memory leaks in the case where
we're out of memory.
parent 8aa69f88
......@@ -203,7 +203,8 @@ git_global_st *git__global_state(void)
if (!ptr)
return NULL;
git_buf_init(&ptr->error_buf, 0);
if (git_buf_init(&ptr->error_buf, 0) < 0)
return NULL;
FlsSetValue(_fls_index, ptr);
return ptr;
......@@ -289,7 +290,9 @@ git_global_st *git__global_state(void)
if (!ptr)
return NULL;
git_buf_init(&ptr->error_buf, 0);
if (git_buf_init(&ptr->error_buf, 0) < 0)
return NULL;
pthread_setspecific(_tls_key, ptr);
return ptr;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment