event-parse: don't free uninitialized token

When alloc_arg() allocation fails token is free'd in the error
exit path, however, at that point token has not been allocated
which can break free().  This fix avoids the erroneous free of
token on the error exit.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
event-parse: fix common realloc out of memory freeing issue

When realloc fails one must not assume it has free'd the original
allocated memory, so one should free this first before bailing out
on the error exit path. For example, see section 7.20.3.4 of the
C11 standard.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Fix a few minor spelling mistakes/typos

Found a few minor spelling mistakes and typos with codespell that
can do with fixing.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
event-parse: fix compilation warning

By default the XSI-compliant strerror_r is being used causing
the warning:

event-parse.c:5121:7: warning: assignment makes pointer from
integer without a cast [enabled by default]
   msg = strerror_r(errnum, buf, buflen);
       ^
Instead, use the GNU-specific strerror_r to avoid this warning.

Signed-off-by: Colin Ian King <colin.king@canonical.com>