Remove turn_free_simple

Do not overload free() from stdlib.h
pull/359/head
Bradley T. Hughes 7 years ago
parent 5e61bea8ec
commit ed91d4bc17
  1. 10
      src/apps/common/ns_turn_utils.c
  2. 2
      src/apps/relay/dbdrivers/dbd_mongo.c
  3. 2
      src/apps/relay/dbdrivers/dbd_mysql.c
  4. 2
      src/apps/relay/dbdrivers/dbd_pgsql.c
  5. 2
      src/apps/relay/dbdrivers/dbd_redis.c
  6. 2
      src/apps/relay/dbdrivers/dbd_sqlite.c
  7. 2
      src/apps/relay/mainrelay.c
  8. 2
      src/apps/relay/userdb.c
  9. 2
      src/ns_turn_defs.h

@ -828,16 +828,6 @@ void turn_free_func(void *ptr, size_t sz, const char* function, int line) {
free(ptr);
}
extern "C" void turn_free_simple(void *ptr);
void turn_free_simple(void *ptr) {
tm_init();
del_tm_ptr(ptr,__FUNCTION__);
free(ptr);
}
extern "C" void *turn_calloc_func(size_t number, size_t size, const char* function, int line);
void *turn_calloc_func(size_t number, size_t size, const char* function, int line) {

@ -1089,7 +1089,7 @@ static void mongo_reread_realms(secrets_list_t * realms_list) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR,
"Error querying MongoDB collection 'realm'\n");
} else {
ur_string_map *o_to_realm_new = ur_string_map_create(turn_free_simple);
ur_string_map *o_to_realm_new = ur_string_map_create(free);
const bson_t * item;
uint32_t length;

@ -1031,7 +1031,7 @@ static void mysql_reread_realms(secrets_list_t * realms_list) {
MYSQL_RES *mres = mysql_store_result(myc);
if(mres && mysql_field_count(myc)==2) {
ur_string_map *o_to_realm_new = ur_string_map_create(turn_free_simple);
ur_string_map *o_to_realm_new = ur_string_map_create(free);
for(;;) {
MYSQL_ROW row = mysql_fetch_row(mres);

@ -748,7 +748,7 @@ static void pgsql_reread_realms(secrets_list_t * realms_list) {
if(res && (PQresultStatus(res) == PGRES_TUPLES_OK)) {
ur_string_map *o_to_realm_new = ur_string_map_create(turn_free_simple);
ur_string_map *o_to_realm_new = ur_string_map_create(free);
int i = 0;
for(i=0;i<PQntuples(res);i++) {

@ -1124,7 +1124,7 @@ static void redis_reread_realms(secrets_list_t * realms_list) {
redisReply *reply = (redisReply*) redisCommand(rc, "keys turn/origin/*");
if (reply) {
ur_string_map *o_to_realm_new = ur_string_map_create(turn_free_simple);
ur_string_map *o_to_realm_new = ur_string_map_create(free);
secrets_list_t keys;

@ -1027,7 +1027,7 @@ static void sqlite_reread_realms(secrets_list_t * realms_list)
if ((rc = sqlite3_prepare(sqliteconnection, statement, -1, &st, 0)) == SQLITE_OK) {
ur_string_map *o_to_realm_new = ur_string_map_create(turn_free_simple);
ur_string_map *o_to_realm_new = ur_string_map_create(free);
while (1) {
int res = sqlite3_step(st);

@ -2154,7 +2154,7 @@ int main(int argc, char **argv)
#endif
ns_bzero(&turn_params.default_users_db,sizeof(default_users_db_t));
turn_params.default_users_db.ram_db.static_accounts = ur_string_map_create(turn_free_simple);
turn_params.default_users_db.ram_db.static_accounts = ur_string_map_create(free);
if(strstr(argv[0],"turnadmin"))
return adminmain(argc,argv);

@ -105,7 +105,7 @@ void create_default_realm()
/* init everything: */
TURN_MUTEX_INIT_RECURSIVE(&o_to_realm_mutex);
init_secrets_list(&realms_list);
o_to_realm = ur_string_map_create(turn_free_simple);
o_to_realm = ur_string_map_create(free);
default_realm_params_ptr = &_default_realm_params;
realms = ur_string_map_create(NULL);
lock_realms();

@ -121,7 +121,6 @@ static inline u64bits _ioa_ntoh64(u64bits v)
void *turn_malloc_func(size_t sz, const char* function, int line);
void *turn_realloc_func(void *ptr, size_t old_sz, size_t new_sz, const char* function, int line);
void turn_free_func(void *ptr, size_t sz, const char* function, int line);
void turn_free_simple(void *ptr);
void *turn_calloc_func(size_t number, size_t size, const char* function, int line);
char *turn_strdup_func(const char* s, const char* function, int line);
void* debug_ptr_add_func(void *ptr, const char* function, int line);
@ -148,7 +147,6 @@ static inline u64bits _ioa_ntoh64(u64bits v)
#define turn_realloc(ptr, old_sz, new_sz) realloc((ptr),(size_t)(new_sz))
#define turn_calloc(number, sz) calloc((number),(size_t)(sz))
#define turn_strdup(s) strdup((s))
#define turn_free_simple free
#define SSL_NEW(ctx) SSL_new(ctx)

Loading…
Cancel
Save