Avoid an asprintf for the single character TEP_EVENT_NEWLINE and TEP_EVENT_DELIM case. Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx> --- src/event-parse.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/event-parse.c b/src/event-parse.c index b6ae67e..16fdb46 100644 --- a/src/event-parse.c +++ b/src/event-parse.c @@ -1232,9 +1232,11 @@ static enum tep_event_type __read_token(struct tep_handle *tep, char **tok) switch (type) { case TEP_EVENT_NEWLINE: case TEP_EVENT_DELIM: - if (asprintf(tok, "%c", ch) < 0) + *tok = malloc(2); + if (!*tok) return TEP_EVENT_ERROR; - + (*tok)[0] = ch; + (*tok)[1] = '\0'; return type; case TEP_EVENT_OP: -- 2.45.0.rc1.225.g2a3ae87e7f-goog