RIOT-OS/RIOT — pull request #643 by N8Fear (2014-02-06 23:21:50+00:00)
Title: fix memory leaks in sys/net/ccn_lite/util/ccn-lite-ctrl.c

Via static analysis using cppcheck I found two memory leaks in sys/net/ccn_lite/util/ccn-lite-ctrl.c:
1. in mkNewFaceRequest(...) there is memory allocated for contentobj. In the next step the function tries to allocate memory for faceinst and returns in the case of failure without freeing the allocated memory for contentobj.
2.in mkPrefixregRequest(...) there is basically the same error with the additional twist that after trying to allocate memory for fwdentry there is an error handling routine that doesn't check for the failure of memory allocation for fwdentry but for contentobj which was checked before and can't have changed.

My commit fixes both issues by freeing the memory for contentobj in both cases if the second allocation of memory fails and in the case of the latter changes the check to use the right variable.