Commit a93813face580b1da5c73546b864c4ea6c7d3064

Martin Pieuchot 2020-01-19T14:18:07

Remove double lock in error path.

diff --git a/tog/tog.c b/tog/tog.c
index 0e878ef..29fe345 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -1424,10 +1424,6 @@ queue_commits(struct got_commit_graph *graph, struct commit_queue *commits,
 
 		if (*searching == TOG_SEARCH_FORWARD && !*search_next_done) {
 			err = match_commit(&have_match, id, commit, regex);
-			if (err) {
-				pthread_mutex_lock(&tog_mutex);
-				break;
-			}
 		}
 
 		errcode = pthread_mutex_unlock(&tog_mutex);
@@ -1435,7 +1431,7 @@ queue_commits(struct got_commit_graph *graph, struct commit_queue *commits,
 			err = got_error_set_errno(errcode,
 			    "pthread_mutex_unlock");
 
-		if (have_match)
+		if (err || have_match)
 			break;
 	}