[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re[3]: (ITS#9127) memory leak in mdb_entry_decode()
Howard Chu, 02 Dec 2019 18:20 MSK:
>
> Since this is allocated in thread-local memory, there is no actual leak.
If so, why does the op->o_tmpfree() exist ?
Konstantin Andreev.
Konstantin Andreev, 02 Dec 2019 16:57 MSK:
>
> mdb_entry_decode() leaks allocated [Entry] on error. Here is a fix for the master branch:
>
> --- a/servers/slapd/back-mdb/id2entry.c
> +++ b/servers/slapd/back-mdb/id2entry.c
> @@ -1130,8 +1130,12 @@ done:
> *e = x;
> rc = 0;
>
> -leave:
> +clr_mvc:
> if (mvc)
> mdb_cursor_close(mvc);
> return rc;
> +leave:
> + /* can't mdb_entry_return() because [Entry *x] init is incomplete */
> + op->o_tmpfree( x, op->o_tmpmemctx );
> + goto clr_mvc;
> }
>
> and for 2.4 branch, if you care:
> ...