diff options
author | Richard Mudgett <rmudgett@digium.com> | 2013-08-28 16:07:30 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2013-08-28 16:07:30 +0000 |
commit | b6a080d6a3db4ab1630c3bf2109849d2b8a8c11e (patch) | |
tree | 05ecdca3eea25e025601ed841f1ae00bc3d6db7c /include/asterisk/threadstorage.h | |
parent | a181544299291664b241ae09be3092be67467546 (diff) |
Match use of ast_free() with ast_calloc() and add some curly braces.
........
Merged revisions 397856 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397857 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/threadstorage.h')
-rw-r--r-- | include/asterisk/threadstorage.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/asterisk/threadstorage.h b/include/asterisk/threadstorage.h index e204748ba..e3ece8b67 100644 --- a/include/asterisk/threadstorage.h +++ b/include/asterisk/threadstorage.h @@ -177,10 +177,11 @@ void *ast_threadstorage_get(struct ast_threadstorage *ts, size_t init_size), pthread_once(&ts->once, ts->key_init); if (!(buf = pthread_getspecific(ts->key))) { - if (!(buf = ast_calloc(1, init_size))) + if (!(buf = ast_calloc(1, init_size))) { return NULL; + } if (ts->custom_init && ts->custom_init(buf)) { - free(buf); + ast_free(buf); return NULL; } pthread_setspecific(ts->key, buf); @@ -197,10 +198,11 @@ void *__ast_threadstorage_get(struct ast_threadstorage *ts, size_t init_size, co pthread_once(&ts->once, ts->key_init); if (!(buf = pthread_getspecific(ts->key))) { - if (!(buf = ast_calloc(1, init_size))) + if (!(buf = ast_calloc(1, init_size))) { return NULL; + } if (ts->custom_init && ts->custom_init(buf)) { - free(buf); + ast_free(buf); return NULL; } pthread_setspecific(ts->key, buf); |