Project

General

Profile

Actions

Bug #1236

closed

free heap missing

Added by p3g4asus over 11 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Immediate
Assignee:
Start date:
01/29/2013
Due date:
% Done:

0%

Estimated time:

Description

Hi,
In function cHelpers::IsWantedChannel(cChannel * channel, string wantedChannels) of the vdrmanager vdr plugin, a call to "free(buffer);" is missing before return statement. This causes garbage and, expecially in small memory enviroments (like mine: Openwrt ar71xx with 64 MB of RAM) also segmentation faults. Here you can find a path for the latest commit (38d1dbda48a5f973b84d6dd8d898869c8fda355a):
http://pastebin.com/PQfFwLR5


Files

01_mallocfree.patch (366 Bytes) 01_mallocfree.patch Unified diff patch file p3g4asus, 01/29/2013 09:01 AM
Actions #1

Updated by herrlado over 11 years ago

  • Priority changed from Normal to Immediate

Thanks for the patch.

The problem is, I am not very familiar witrh c/c++ programming and also an other guy has coded this plugin. I have added just a few features and so on.

What I am saying is, every review or patch is very welcome to improve the quality.

Lado

Actions #2

Updated by herrlado over 11 years ago

  • Assignee set to herrlado
  • Target version changed from vdr-plugin-vdrmanager-0.9 to 313
Actions #3

Updated by herrlado over 11 years ago

So as I understand, after each memory allocation there should be a free() call ?

Actions #4

Updated by p3g4asus over 11 years ago

herrlado wrote:

So as I understand, after each memory allocation there should be a free() call ?

Yes, this is what mainly makes c++ and the other unmanaged programming languages different from JAVA or C# (that are managed languages). When you allocate some memory in the heap (using malloc or calloc), you should use free whan you want to release it. Otherwise it will remain there and if you have no pointer to it, it will be completely unusable. Remember that after the free call you should not retain any pointer to the freed memory, because trying to read previously freed memory, causes crashes (segfaults).

Actions #5

Updated by herrlado over 11 years ago

OK, Thanks!

Should be now in the repository.

I will release as version 0.10, perhaps there are other changes too, I mus check it.

Actions #6

Updated by herrlado over 11 years ago

  • Status changed from New to Feedback
Actions #7

Updated by p3g4asus over 11 years ago

I can give you positive feedback. With this release I get no segfault, while I was getting with the previouse one. You can mark this bug as closed / fixed, I think or maybe wait for other feedbacks. Thank you very much for the quick response and thanks for this great plugin / android app too.

Actions #8

Updated by herrlado over 11 years ago

  • Status changed from Feedback to Resolved
  • Target version changed from 313 to vdr-plugin-vdrmanager-0.9
Actions #9

Updated by herrlado about 11 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF