mirror of https://github.com/Desuuuu/klipper.git
stepcompress: Fix error causing queue to not be expanded in expand_queue()
The test to check if the queue only needed to be moved was not correct and it could lead to a segfault if clean_queue() was called instead of actually increasing the queue size. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
3fa7da804d
commit
4988ba9a71
|
@ -59,11 +59,11 @@ clean_queue(struct stepcompress *sc)
|
||||||
static void
|
static void
|
||||||
expand_queue(struct stepcompress *sc, int count)
|
expand_queue(struct stepcompress *sc, int count)
|
||||||
{
|
{
|
||||||
if (sc->queue + count <= sc->queue_end) {
|
int alloc = sc->queue_end - sc->queue;
|
||||||
|
if (count + sc->queue_next - sc->queue_pos <= alloc) {
|
||||||
clean_queue(sc);
|
clean_queue(sc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int alloc = sc->queue_end - sc->queue;
|
|
||||||
int pos = sc->queue_pos - sc->queue;
|
int pos = sc->queue_pos - sc->queue;
|
||||||
int next = sc->queue_next - sc->queue;
|
int next = sc->queue_next - sc->queue;
|
||||||
if (!alloc)
|
if (!alloc)
|
||||||
|
|
Loading…
Reference in New Issue