Remove usage of index and mallocz.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>