mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-13 12:09:35 +03:00
Fix a regression that caused a segfault when using scrollback_pager_history_size
Fixes #3011
This commit is contained in:
parent
b04b0c670d
commit
fb87fc32f0
@ -10,6 +10,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
||||
- hints kitten: Add an ``ip`` type for easy selection of IP addresses
|
||||
(:pull:`3009`)
|
||||
|
||||
- Fix a regression that caused a segfault when using
|
||||
:opt:`scrollback_pager_history_size` and it gets full (:iss:`3011`)
|
||||
|
||||
- Fix update available notifications repeating (:pull:`3006`)
|
||||
|
||||
|
||||
|
@ -78,8 +78,8 @@ free_pagerhist(HistoryBuf *self) {
|
||||
static inline bool
|
||||
pagerhist_extend(PagerHistoryBuf *ph, size_t minsz) {
|
||||
if (ph->buffer_size >= ph->max_sz) return false;
|
||||
size_t newsz = ph->buffer_size + MAX(1024u * 1024u, minsz);
|
||||
uint8_t *newbuf = PyMem_Malloc(MIN(ph->buffer_size + minsz, ph->max_sz));
|
||||
size_t newsz = MIN(ph->max_sz, ph->buffer_size + MAX(1024u * 1024u, minsz));
|
||||
uint8_t *newbuf = PyMem_Malloc(newsz);
|
||||
if (!newbuf) return false;
|
||||
size_t copied = MIN(ph->length, ph->buffer_size - ph->start);
|
||||
if (copied) memcpy(newbuf, ph->buffer + ph->start, copied);
|
||||
|
Loading…
Reference in New Issue
Block a user