rtmp: remove unused allocation and copy

This commit is contained in:
Dan Kortschak 2018-06-01 08:25:30 +09:30
parent 12c458b415
commit 65a4abb24b
1 changed files with 0 additions and 6 deletions

View File

@ -65,22 +65,16 @@ RTMP* start_session(RTMP* rtmp, char* url, uint connect_timeout) {
} }
unsigned int write_frame(RTMP* rtmp, char* data, uint data_length) { unsigned int write_frame(RTMP* rtmp, char* data, uint data_length) {
char* dataForC = malloc(data_length);
memcpy(dataForC,data,data_length);
if (!RTMP_IsConnected(rtmp)) { if (!RTMP_IsConnected(rtmp)) {
printf("RTMP is not connected!\n"); printf("RTMP is not connected!\n");
free(dataForC);
return 1; return 1;
} }
if (!RTMP_Write(rtmp, (const char*)data, data_length)) { if (!RTMP_Write(rtmp, (const char*)data, data_length)) {
printf("RTMP write error!\n"); printf("RTMP write error!\n");
free(dataForC);
return 1; return 1;
} }
free(dataForC);
return 0; return 0;
} }