2
0
mirror of https://github.com/vasi/pixz synced 2024-10-30 15:21:41 +00:00

Merge pull request #105 from usefulcat/master

Bug fix for segfault
This commit is contained in:
Dave Vasilevsky 2023-09-13 17:45:17 -04:00 committed by GitHub
commit 8155addb46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -388,13 +388,13 @@ void queue_free(queue_t *q) {
}
void queue_push(queue_t *q, int type, void *data) {
pthread_mutex_lock(&q->mutex);
queue_item_t *i = malloc(sizeof(queue_item_t));
i->type = type;
i->data = data;
i->next = NULL;
pthread_mutex_lock(&q->mutex);
if (q->last) {
q->last->next = i;
} else {
@ -415,12 +415,12 @@ int queue_pop(queue_t *q, void **datap) {
q->first = i->next;
if (!q->first)
q->last = NULL;
pthread_mutex_unlock(&q->mutex);
*datap = i->data;
int type = i->type;
free(i);
pthread_mutex_unlock(&q->mutex);
return type;
}

View File

@ -536,7 +536,7 @@ static void read_thread(void) {
debug("read: skip %llu", iter.block.number_in_file);
continue;
}
for ( ; w && w->end < uend; w = w->next) ;
for ( ; w && w->end <= uend; w = w->next) ;
}
debug("read: want %llu", iter.block.number_in_file);