FS-5240: --resolve Please test
This commit is contained in:
parent
784d5722fa
commit
17781cba1c
|
@ -202,16 +202,21 @@ static amf0_data * amf0_boolean_read(read_proc_t read_proc, void * user_data) {
|
||||||
/* read a string */
|
/* read a string */
|
||||||
static amf0_data * amf0_string_read(read_proc_t read_proc, void * user_data) {
|
static amf0_data * amf0_string_read(read_proc_t read_proc, void * user_data) {
|
||||||
uint16_t strsize;
|
uint16_t strsize;
|
||||||
uint8_t * buffer;
|
uint8_t * buffer = NULL;
|
||||||
|
amf0_data *data = NULL;
|
||||||
if (read_proc(&strsize, sizeof(uint16_t), user_data) == sizeof(uint16_t)) {
|
if (read_proc(&strsize, sizeof(uint16_t), user_data) == sizeof(uint16_t)) {
|
||||||
strsize = swap_uint16(strsize);
|
strsize = swap_uint16(strsize);
|
||||||
if (strsize > 0) {
|
if (strsize > 0) {
|
||||||
buffer = (uint8_t*) calloc(strsize, sizeof(uint8_t));
|
buffer = (uint8_t*) calloc(strsize, sizeof(uint8_t));
|
||||||
if (buffer != NULL && read_proc(buffer, strsize, user_data) == strsize) {
|
if ( buffer == NULL ) {
|
||||||
amf0_data * data = amf0_string_new(buffer, strsize);
|
return NULL; // Memory error
|
||||||
free(buffer);
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
if ( read_proc(buffer, strsize, user_data) == strsize ) {
|
||||||
|
data = amf0_string_new(buffer, strsize);
|
||||||
|
}
|
||||||
|
free(buffer);
|
||||||
|
buffer = NULL;
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return amf0_string_new(NULL, 0);
|
return amf0_string_new(NULL, 0);
|
||||||
|
@ -634,9 +639,11 @@ void amf0_data_free(amf0_data * data) {
|
||||||
case AMF0_TYPE_NUMBER: break;
|
case AMF0_TYPE_NUMBER: break;
|
||||||
case AMF0_TYPE_BOOLEAN: break;
|
case AMF0_TYPE_BOOLEAN: break;
|
||||||
case AMF0_TYPE_STRING:
|
case AMF0_TYPE_STRING:
|
||||||
if (data->u.string_data.mbstr != NULL) {
|
if (data->u.string_data.mbstr) {
|
||||||
free(data->u.string_data.mbstr);
|
free(data->u.string_data.mbstr);
|
||||||
} break;
|
data->u.string_data.mbstr = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case AMF0_TYPE_NULL: break;
|
case AMF0_TYPE_NULL: break;
|
||||||
case AMF0_TYPE_UNDEFINED: break;
|
case AMF0_TYPE_UNDEFINED: break;
|
||||||
/*case AMF0_TYPE_REFERENCE:*/
|
/*case AMF0_TYPE_REFERENCE:*/
|
||||||
|
@ -813,7 +820,8 @@ uint32_t amf0_object_size(amf0_data * data) {
|
||||||
|
|
||||||
amf0_data * amf0_object_add(amf0_data * data, const char * name, amf0_data * element) {
|
amf0_data * amf0_object_add(amf0_data * data, const char * name, amf0_data * element) {
|
||||||
if (data != NULL) {
|
if (data != NULL) {
|
||||||
if (amf0_list_push(&data->u.list_data, amf0_str(name)) != NULL) {
|
amf0_data *str_name = amf0_str(name);
|
||||||
|
if (amf0_list_push(&data->u.list_data, str_name) != NULL) {
|
||||||
if (amf0_list_push(&data->u.list_data, element) != NULL) {
|
if (amf0_list_push(&data->u.list_data, element) != NULL) {
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
@ -821,6 +829,7 @@ amf0_data * amf0_object_add(amf0_data * data, const char * name, amf0_data * ele
|
||||||
amf0_data_free(amf0_list_pop(&data->u.list_data));
|
amf0_data_free(amf0_list_pop(&data->u.list_data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
amf0_data_free(str_name);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -871,8 +871,6 @@ switch_status_t rtmp_session_destroy(rtmp_session_t **rsession)
|
||||||
switch_thread_rwlock_wrlock((*rsession)->rwlock);
|
switch_thread_rwlock_wrlock((*rsession)->rwlock);
|
||||||
switch_thread_rwlock_unlock((*rsession)->rwlock);
|
switch_thread_rwlock_unlock((*rsession)->rwlock);
|
||||||
|
|
||||||
(*rsession)->profile->io->close(*rsession);
|
|
||||||
|
|
||||||
#ifdef RTMP_DEBUG_IO
|
#ifdef RTMP_DEBUG_IO
|
||||||
fclose((*rsession)->io_debug_in);
|
fclose((*rsession)->io_debug_in);
|
||||||
fclose((*rsession)->io_debug_out);
|
fclose((*rsession)->io_debug_out);
|
||||||
|
|
|
@ -178,6 +178,14 @@ static switch_status_t rtmp_tcp_close(rtmp_session_t *rsession)
|
||||||
switch_socket_close(io_pvt->socket);
|
switch_socket_close(io_pvt->socket);
|
||||||
io_pvt->socket = NULL;
|
io_pvt->socket = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( io_pvt->sendq ) {
|
||||||
|
switch_buffer_destroy(&(io_pvt->sendq));
|
||||||
|
}
|
||||||
|
|
||||||
|
free(rsession->io_private);
|
||||||
|
rsession->io_private = NULL;
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,6 +285,8 @@ void *SWITCH_THREAD_FUNC rtmp_io_tcp_thread(switch_thread_t *thread, void *obj)
|
||||||
switch_socket_close(io_pvt->socket);
|
switch_socket_close(io_pvt->socket);
|
||||||
io_pvt->socket = NULL;
|
io_pvt->socket = NULL;
|
||||||
|
|
||||||
|
io->base.close(rsession);
|
||||||
|
|
||||||
rtmp_session_destroy(&rsession);
|
rtmp_session_destroy(&rsession);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue