On Thu, 1 Jun 2017 22:24:47 +1000 David Gibson <da...@gibson.dropbear.id.au> wrote: [...] > > > > Yeah. This basically does: > > > > inpieces[i + 1] = inpieces[i]; > > > > and we end up overwriting the terminal NULL pointer with a non-NULL > > pointer. > > > > What about simplifying the loop to: > > > > /* inpieces[0] is the actual model string */ > > i = 1; > > while (inpieces[i]) { > > if (g_str_has_prefix(inpieces[i], "compat=")) { > > /* in case of multiple compat= optipons */ > > g_free(compat_str); > > compat_str = inpieces[i]; > > /* Excise compat options from list */ > > inpieces[i] = inpieces[i + 1]; > > } > > i++; > > } > > No.. that would duplicate the entry after the compat=, instead of > properly excising it. I've already fixed this for my next draft. >
D'oh you're right... sorry for the noise :)
pgpIjpbwBS20Z.pgp
Description: OpenPGP digital signature