On Mon, 17 May 2021 16:23:56 +1000 David Gibson wrote: > On Sat, May 15, 2021 at 01:07:59PM +0530, Vaibhav Jain wrote: [...] > > + rc = (result == MEMTX_OK) ? > > + scm_perf_check_rr_buffer(perfstats, addr, size, &num_stats) : > > + H_PRIVILEGE; > > This is a bit cryptic. Just deal with the memtx error first, then run > the buffer validation. Actually, you can unify the exit paths for > these and the success case by using a goto label near the end which > has the g_free() and return rc. > It seems all the g_free() calls could even be avoided by converting perfstats to g_autofree.