ctf_discard(): fetch the next list element before restarting the loop. If

we end up skipping a dynamic type because it has already been committed to
the container, we would previously either set the loop variable to an
uninitialized local variable, or set it to itself, resulting in an infinite
loop.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Mark Johnston 2015-03-10 20:52:03 +00:00
parent 26a222dc0c
commit ba8d15d3a8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=279862

View File

@ -583,10 +583,10 @@ ctf_discard(ctf_file_t *fp)
return (0); /* no update required */
for (dtd = ctf_list_prev(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) {
ntd = ctf_list_prev(dtd);
if (dtd->dtd_type <= fp->ctf_dtoldid)
continue; /* skip types that have been committed */
ntd = ctf_list_prev(dtd);
ctf_dtd_delete(fp, dtd);
}