On Mon, May 17, 2021 at 09:55:31AM +0200, Greg Kurz wrote: > On Mon, 17 May 2021 16:23:56 +1000 > David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> 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. That's an even better idea. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Attachment:
signature.asc
Description: PGP signature