Use jv_mem_alloc to allocate dtoa_context in tsd_dtoa_context_get (#3356)
This commit is contained in:
1 file changed
+2
-1
+2
-1
@@ -40,9 +40,10 @@ inline struct dtoa_context *tsd_dtoa_context_get(void) {
|
||||
pthread_once(&dtoa_ctx_once, jv_tsd_dtoa_ctx_init); // cannot fail
|
||||
struct dtoa_context *ctx = (struct dtoa_context*)pthread_getspecific(dtoa_ctx_key);
|
||||
if (!ctx) {
|
||||
ctx = malloc(sizeof(struct dtoa_context));
|
||||
ctx = jv_mem_alloc(sizeof(struct dtoa_context));
|
||||
jvp_dtoa_context_init(ctx);
|
||||
if (pthread_setspecific(dtoa_ctx_key, ctx) != 0) {
|
||||
jv_mem_free(ctx);
|
||||
fprintf(stderr, "error: cannot set thread specific data");
|
||||
abort();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user