GabuEx/my-little-investigations — pull request #34 by phantom10111 (2014-12-26 21:04:57+00:00)
Title: Memory and FFMpeg fixes

I found a lot of memory leaks/uninitialized values etc. in the code. This is an attempt in fixing most of them.

Unfortunately, this is not all. There are other leaks that usually follow a pattern - allocate an object, add it to a manager and at this point I don't know who is supposed to take care of freeing it or where do pointers get overwritten and lost. I may figure it out later but there's a lot of managers so it will probably take some time.

I also made some changes to the FFMpeg code that may cause compilation problems when using earlier FFMpeg versions. If you decide this is not acceptable that's fine, but I think it would be a good idea to use as new version as possible for future builds.

There is a report of mli crashing with FFMpeg 2.4 and optimization on linux. I came across a similar crash at around the same place in the code, except that the cause is not `pFormatContext` being `NULL`, but that FFMpeg added a new field `mime_type` to `AVProbeData`. That field was uninitialized and for some reason it wasn't crashing without optimization. The report says that with version 2.3 it runs well and incidentally the new field wasn't there until version 2.4. I'm thinking the report is wrong and that the problem is fixed here.

If you have any other questions about the changes here, please ask.