On Mon, Jul 2, 2018 at 11:38 AM, Nicolas Iooss <nicolas.iooss@xxxxxxx> wrote: > On Sun, Jul 1, 2018 at 10:51 PM, William Roberts > <bill.c.roberts@xxxxxxxxx> wrote: >> I see lots of repeating blocks, would it make more sense to goto an >> error label and free them then return -1? > > Both trans_context() and untrans_context() currently define "char > *ltrans = NULL, *utrans = NULL;" and "char *lrange = NULL, *urange = > NULL;" in the body of a for loop. Introducing an error label at the > end of these functions requires moving these definition outside of the > loop (which could introduce side effects) and introducing the label at > the end of the loop makes the code less readable, IMHO. I guess this > could explain why the current code does not use a "goto error" or > "goto clean" approach and leaks memory where an error occurs. > > Anyway, if you are fine with moving the definitions of some variables > (ltrans and utrans for trans_context(), lrange and urange for > untrans_context()), I can write, test and send a new patch with a > "goto error" instead of several free(). This seems fine. I just applied and tested this (finally). Ack. > > Thanks for your review, > Nicolas > _______________________________________________ Selinux mailing list Selinux@xxxxxxxxxxxxx To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx. To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.