Merge pull request #105 from usefulcat/master

Bug fix for segfault
pull/41/merge
Dave Vasilevsky 9 months ago committed by GitHub
commit 8155addb46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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;
}

@ -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);

Loading…
Cancel
Save