libcgc: Do not repurpose in-use variable

This can lead to a crash, so let's use the unused variable 'j'
instead.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>