src/driver/streamts.cpp: use new instead of malloc

This commit is contained in:
satbaby
2012-11-05 16:48:41 +01:00
parent 80fe0c9307
commit 4e3791be72

View File

@@ -259,11 +259,10 @@ void * streamts_live_thread(void *data)
char cbuf[512]; char cbuf[512];
char *bp; char *bp;
int fd = (int) data; int fd = (int) data;
FILE * fp;
unsigned char demuxfd_count = 0; unsigned char demuxfd_count = 0;
printf("Starting LIVE STREAM thread, fd %d\n", fd); printf("Starting LIVE STREAM thread, fd %d\n", fd);
fp = fdopen(fd, "r+"); FILE * fp = fdopen(fd, "r+");
if(fp == NULL) { if(fp == NULL) {
perror("fdopen"); perror("fdopen");
return 0; return 0;
@@ -323,9 +322,9 @@ void * streamts_live_thread(void *data)
pids[demuxfd_count++] = channel->getAudioChannel(i)->pid; pids[demuxfd_count++] = channel->getAudioChannel(i)->pid;
} }
buf = (unsigned char *) malloc(IN_SIZE); buf = new unsigned char [IN_SIZE];
if (buf == NULL) { if (buf == NULL) {
perror("malloc"); perror("NEW");
return 0; return 0;
} }
@@ -353,7 +352,7 @@ void * streamts_live_thread(void *data)
CCamManager::getInstance()->Stop(CZapit::getInstance()->GetCurrentChannelID(), CCamManager::STREAM); CCamManager::getInstance()->Stop(CZapit::getInstance()->GetCurrentChannelID(), CCamManager::STREAM);
delete dmx; delete dmx;
free(buf); delete []buf;
close(fd); close(fd);
return 0; return 0;
} }