Commit Diff


commit - 84451b3ef755f3226d0d79af367632e5f3a830e7
commit + 67c4c153acf0aeb91d39ea45524663e032ab2fe6
blob - 343f4c6f06df7a59fcff7d6df42e716c0f0b1ea3
blob + 4404ee43ec1521f107a9d8924d5d1c0b20c921cd
--- tog/tog.c
+++ tog/tog.c
@@ -1182,7 +1182,7 @@ show_blame_view(const char *path, struct got_object_id
 	struct got_object *obj = NULL;
 	struct got_blob_object *blob = NULL;
 	FILE *f = NULL;
-	size_t filesize, nlines;
+	size_t filesize, nlines = 0;
 	struct tog_blame_line *lines = NULL;
 	pthread_t thread = NULL;
 	pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -1315,15 +1315,17 @@ show_blame_view(const char *path, struct got_object_id
 		}
 	}
 done:
+	if (thread) {
+		if (pthread_join(thread, (void **)&err) != 0)
+			err = got_error_from_errno();
+	}
 	if (blob)
 		got_object_blob_close(blob);
 	if (f)
 		fclose(f);
+	for (i = 0; i < nlines; i++)
+		free(lines[i].id);
 	free(lines);
-	if (thread) {
-		if (pthread_join(thread, (void **)&err) != 0)
-			err = got_error_from_errno();
-	}
 	return err;
 }