commit - d1bd49a9f4cb68bfe8dd012bcf41342bf93135e1
commit + 0b570e72a9d79d0b3b0927c99cdbaff8cea86f37
blob - 25bddbc9c0a8c95dc7b5008c82de519be7d36960
blob + 6d3e738e1220743df1fd30ba6a2779ff5b504e3e
--- 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);