[vdr] vdr 1.3.25 thread problems

Wolfgang Rohdewald wolfgang at rohdewald.de
Thu Jun 2 00:08:17 CEST 2005


>      asprintf(&cmd, "%s %s \"%s\"", command, State, *strescape(RecordingFileName, "\"$"));
> 
> Does asprintf know it can release the memory?

Certainly not.

I am by no way a C++ expert but I think *strescape is treated as an automatically
allocated object which will automatically be destroyed when its scope is left.
You only need to delete objects which have been created with new.

The same should be true for your first example in cTDT::cTDT()

You can put debug output into cString::~cString() to verify that.

> What happens if the malloc fails?

You will find a dozen or so places in vdr where the MALLOC result is not
checked for NULL. I just wonder why in some cases there are checks like 
here:

cResumeFile::cResumeFile(const char *FileName)
{
  fileName = MALLOC(char, strlen(FileName) + strlen(RESUMEFILESUFFIX) + 1);
  if (fileName) {


-- 
Wolfgang



More information about the vdr mailing list