diff --git a/rtmp/RTMPWrapper.c b/rtmp/RTMPWrapper.c index 21598c01..0b0750a8 100644 --- a/rtmp/RTMPWrapper.c +++ b/rtmp/RTMPWrapper.c @@ -65,12 +65,16 @@ unsigned int RTMP_start_session(char* url, uint connect_timeout){ } unsigned int RTMP_write_frame(char* data, uint data_length){ + dataForC = malloc(data_length); + memcpy(dataForC,data,data_length); if (!RTMP_IsConnected(rtmp)) { printf("RTMP is not connected!\n"); + free(dataForC); return 0; } if (!RTMP_Write(rtmp, (const char*)data, data_length)) { printf("RTMP write error!\n"); + free(dataForC); return 0; } return 1;