ZoneMinder/ZoneMinder — pull request #574 by manupap1 (2014-11-14 21:34:11+00:00)
Title: Fix memory leaks with rtsp and a bug

Memory leaks fixed:

- mysql_store_result is called but not mysql_free_result
- avformat_alloc_context is called but not avformat_free_context
- sessDesc is dynamically allocated but memory is never released
- mAuthenticator is dynamically allocated but memory is never released
- Dynamic allocation of memory by the use of '%a' in sccanf function is not released (sccanf replaced by c++ functions)
- Memory for mConnInfo and mBandInfo may be allocated multiple times if the corresponding field appears more than one time in SDP and memory is never released (code added to keep only the last value)
- New MediaDescriptors are added to the mMediaList vector but they are never deleted

All this leaks have been detected with valgrind.

A question:

Does zm binaries have ever passed successfully a single memory check test ?
I think no because every zm binaries open a logger session but never close it (the same for database access).

Bugs fixed:

The response to a SETUP command may not include the timeout parameter (fixed with the new code to address the memory leak).