Check the array offset first in a conditional.
Comment fixes (typos, missing words).
Fix a 1 byte leak in the 'new' command when ...

... the keyname is not specified, so the closing NUL would be
xmlStrdup()'d.
Found by valgrind.
Plug in leaks during command/keychain completion.

Found by valgrind.
Insufficient memory allocation for the filename's extension in 'xport'.

Found by valgrind.
Plug leaks of largv[] contents after larg() use.

So, also free up the memory allocated for the largv[] array's elements,
before freeing up the memory that holds the array of pointers to those
elements' addresses.

Valgrind found this.
Explicitly free up the digest context that EVP_DigestFinal() fails to do.

Valgrind found out, that the openssl manual is a lie, and
EVP_DigestFinal()'s ability to free up the given digest context (in
contrast to EVP_DigestFinal_ex()) does not exist.
Oops. Reflect usage changes in the rest of the commands too.
Plugin leaks in regex search ('/', 'c/' commands)

Free up the compiled regex context and the extra study stuff.
Also make sure to always free up the 'key' variable.

Found with Valgrind.
Make sure we always free up the 'key' variable.

Found with Valgrind.
Plug two leaks and fix a too early free() in 'cdel'.

All found by valgrind. You gotta' love this utility.
Plug the leakage of the resolved path allocated with realpath().

Valgrind.
Always free the 'key' variable, not just when the user answered yes.
Free the printed line from the value in the right place.

Do not overwrite the 'line' variable with every iteration of the line
displaying loop (multiline or not multiline), but free it at its end,
and then we can safely request a new line from the value at the
beginning.
When moving a key, free the old key element after unlinking.

We can safely do this, because we have duplicated the old key before
copying/moving.

Found by Valgrind.