commit - 8a1f36275eaed118cb07b7249c136e3da8d0ef62
commit + 2a2e593352ba687c161d743f54bf5addc8f06d7d
blob - ead293d381171fe6a5cefeb397cc88b5de8b9910
blob + de94ddedf322329e50f2e9155daa6a586c650eeb
--- tog/tog.c
+++ tog/tog.c
create_diff(struct tog_diff_view_state *s)
{
const struct got_error *err = NULL;
- FILE *f = NULL, *tmp_diff_file = NULL;
+ FILE *tmp_diff_file = NULL;
int obj_type;
struct got_diff_line *lines = NULL;
struct got_pathlist_head changed_paths;
return got_error_from_errno("malloc");
s->nlines = 0;
- f = got_opentemp();
- if (f == NULL) {
- err = got_error_from_errno("got_opentemp");
- goto done;
+ if (s->f && fclose(s->f) == EOF) {
+ s->f = NULL;
+ return got_error_from_errno("fclose");
}
+
+ s->f = got_opentemp();
+ if (s->f == NULL)
+ return got_error_from_errno("got_opentemp");
+
tmp_diff_file = got_opentemp();
- if (tmp_diff_file == NULL) {
- err = got_error_from_errno("got_opentemp");
- goto done;
- }
- if (s->f && fclose(s->f) == EOF) {
- err = got_error_from_errno("fclose");
- goto done;
- }
- s->f = f;
+ if (tmp_diff_file == NULL)
+ return got_error_from_errno("got_opentemp");
if (s->id1)
err = got_object_get_type(&obj_type, s->repo, s->id1);