Skip to content

Fix various memory leaks

Simon McVittie requested to merge wip/smcv/memleaks into master

While adding a convenience script to set up multiple build directories and build/test them all, I tried to use AddressSanitizer for the main build, but ran into some memory leaks. This branch fixes most of them (there's one left that I haven't fully diagnosed yet - it's more difficult because I don't get a proper backtrace).

  • pressure-vessel: Chain up to finalize graphics provider

    Otherwise, we won't free the associated qdata and anything else that's freed in g_object_finalize().

  • PvRuntime: Don't leak lists of objects when precaching drivers

    We're ignoring these lists of objects (we're only fetching them in order to populate the SrtSystemInfo's cache) but we still need to release the references.

  • system-info: Don't leak array of multiarch tuples

  • pv-runtime: Don't leak array of threads

  • graphics: Fix memory leaks when using SRT_CHECK_FLAGS_SKIP_EXTRAS

    Previously, we only freed these strings and objects if the SRT_CHECK_FLAGS_SKIP_EXTRAS flag was not used.

  • graphics: Narrow scope of 'extras'

    If we move this into a narrower scope, it becomes more obvious that we always free it when necessary.

    We don't need the "if (extras)" guard, because NULL is a valid linked list (specifically, it's the empty linked list).

  • graphics: Make more use of g_autoptr

    I don't think this actually fixes any memory leaks, but it makes it more obvious that we're doing the right things.

Merge request reports

Loading