commit - ba77389f9f3a659ebd77c8a4b4974c645e0530fd
commit + 61dc16bb64b935a7b13342b8bc47db282d10e676
blob - 572a730d092394c09f1ea83b262cf72884cc2dac
blob + ff292e9cadc7e6213f828308478d7827b79cb69a
--- tog/tog.c
+++ tog/tog.c
struct tog_log_view_state *s = &view->state.log;
const struct got_error *err = NULL;
char datebuf[12]; /* YYYY-MM-DD + SPACE + NUL */
+ char *refs_str = NULL;
char *logmsg0 = NULL, *logmsg = NULL;
char *author = NULL;
wchar_t *wlogmsg = NULL, *wauthor = NULL;
/* Prepend reference labels to log message if possible .*/
refs = got_reflist_object_id_map_lookup(tog_refs_idmap, id);
- if (refs) {
- char *refs_str, *newlogmsg;
- wchar_t *ws;
-
+ if (refs)
err = build_refs_str(&refs_str, refs, id, s->repo);
- if (err)
- goto done;
+ if (err)
+ goto done;
+ if (refs_str) {
+ char *newlogmsg;
+ wchar_t *ws;
/*
* The length of this wide-char sub-string will be
if (asprintf(&newlogmsg, "[%s] %s", refs_str, logmsg) == -1) {
err = got_error_from_errno("asprintf");
- free(refs_str);
goto done;
}
- free(refs_str);
free(logmsg0);
logmsg0 = newlogmsg;
done:
free(logmsg0);
free(wlogmsg);
+ free(refs_str);
free(author);
free(wauthor);
free(line);