Fixed a memory leak in the SVDRP command LSTE; fixed a typo in LSTE's help

This commit is contained in:
Klaus Schmidinger 2005-08-07 14:25:31 +02:00
parent 4217d30bff
commit 1921c7465f
3 changed files with 21 additions and 12 deletions

View File

@ -199,6 +199,7 @@ Stefan Huelswitt <huels@iname.com>
for fixing a memory leak in cDvbPlayer
for pointing out that recordings with empty episode names were not listed correctly
in the LSTR command
for fixing a memory leak in the SVDRP command LSTE
Ulrich Röder <roeder@efr-net.de>
for pointing out that there are channels that have a symbol rate higher than 27500

View File

@ -3670,3 +3670,4 @@ Video Disk Recorder Revision History
- Fixed cDvbSpuBitmap::putPixel() (thanks to Reinhard Nissl).
- Fixed setting system time to avoid time jumps in case of faulty data (thanks
to Andreas Böttger).
- Fixed a memory leak in the SVDRP command LSTE (thanks to Stefan Huelswitt).

31
svdrp.c
View File

@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
* $Id: svdrp.c 1.73 2005/07/31 14:31:45 kls Exp $
* $Id: svdrp.c 1.74 2005/08/07 14:20:41 kls Exp $
*/
#include "svdrp.h"
@ -209,7 +209,7 @@ const char *HelpPages[] = {
" containing the given string as part of their name are listed.",
"LSTE [ <channel> ] [ now | next | at <time> ]\n"
" List EPG data. Without any parameters all data of all channels is\n"
" listed. If a channel is given (either by number of by channel ID),\n"
" listed. If a channel is given (either by number or by channel ID),\n"
" only data for that channel is listed. 'now', 'next', or 'at <time>'\n"
" restricts the returned data to present events, following events, or\n"
" events at the given time (which must be in time_t form).",
@ -790,18 +790,25 @@ void cSVDRP::CmdLSTE(const char *Option)
p = strtok_r(NULL, delim, &strtok_next);
}
}
FILE *f = fdopen(file, "w");
if (f) {
if (Schedule)
Schedule->Dump(f, "215-", DumpMode, AtTime);
else
Schedules->Dump(f, "215-", DumpMode, AtTime);
fflush(f);
Reply(215, "End of EPG data");
// don't 'fclose(f)' here!
int fd = dup(file);
if (fd) {
FILE *f = fdopen(fd, "w");
if (f) {
if (Schedule)
Schedule->Dump(f, "215-", DumpMode, AtTime);
else
Schedules->Dump(f, "215-", DumpMode, AtTime);
fflush(f);
Reply(215, "End of EPG data");
fclose(f);
}
else {
Reply(451, "Can't open file connection");
close(fd);
}
}
else
Reply(451, "Can't open file connection");
Reply(451, "Can't dup stream descriptor");
}
else
Reply(451, "Can't get EPG data");