Skip to content

Commit e4da5f1

Browse files
committed
Change connection->userdata allocation to pool from malloc
1 parent d19005c commit e4da5f1

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

mosquitto_mosq.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,18 +1246,12 @@ switch_status_t mosq_new(mosquitto_profile_t *profile, mosquitto_connection_t *c
12461246
return SWITCH_STATUS_SUCCESS;
12471247
}
12481248

1249-
/*
12501249
if (!(userdata = (mosquitto_mosq_userdata_t *)switch_core_alloc(profile->pool, sizeof(mosquitto_mosq_userdata_t)))) {
12511250
log(SWITCH_LOG_CRIT, "mosq_new() Failed to allocate memory for mosquitto_new() userdata structure profile %s connection %s\n", profile->name, connection->name);
12521251
return SWITCH_STATUS_GENERR;
1253-
} else {
1254-
connection->userdata = userdata;
1255-
userdata->profile = profile;
1256-
userdata->connection = connection;
12571252
}
1258-
*/
1253+
//switch_malloc(userdata, sizeof(mosquitto_mosq_userdata_t));
12591254

1260-
switch_malloc(userdata, sizeof(mosquitto_mosq_userdata_t));
12611255
connection->userdata = userdata;
12621256
userdata->profile = profile;
12631257
userdata->connection = connection;
@@ -1335,7 +1329,7 @@ switch_status_t mosq_destroy(mosquitto_connection_t *connection)
13351329
}
13361330
profile = (mosquitto_profile_t *)userdata->profile;
13371331
log(SWITCH_LOG_DEBUG, "mosq_destroy(): profile %s connection %s\n", profile->name, connection->name);
1338-
switch_safe_free(connection->userdata);
1332+
// switch_safe_free(connection->userdata);
13391333
#endif
13401334

13411335
mosquitto_destroy(connection->mosq);

0 commit comments

Comments
 (0)