Fix failure to trim querybuf (and memory tests that fail because of it)
This commit is contained in:
parent
906308d728
commit
cfabd4f666
@ -1926,6 +1926,7 @@ int processMultibulkBuffer(client *c) {
|
|||||||
* pending query buffer, already representing a full command, to process. */
|
* pending query buffer, already representing a full command, to process. */
|
||||||
void processInputBuffer(client *c) {
|
void processInputBuffer(client *c) {
|
||||||
AssertCorrectThread(c);
|
AssertCorrectThread(c);
|
||||||
|
bool fFreed = false;
|
||||||
|
|
||||||
/* Keep processing while there is something in the input buffer */
|
/* Keep processing while there is something in the input buffer */
|
||||||
while(c->qb_pos < sdslen(c->querybuf)) {
|
while(c->qb_pos < sdslen(c->querybuf)) {
|
||||||
@ -1990,13 +1991,16 @@ void processInputBuffer(client *c) {
|
|||||||
/* freeMemoryIfNeeded may flush slave output buffers. This may
|
/* freeMemoryIfNeeded may flush slave output buffers. This may
|
||||||
* result into a slave, that may be the active client, to be
|
* result into a slave, that may be the active client, to be
|
||||||
* freed. */
|
* freed. */
|
||||||
if (server.current_client == NULL) break;
|
if (server.current_client == NULL) {
|
||||||
|
fFreed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
server.current_client = NULL;
|
server.current_client = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Trim to pos */
|
/* Trim to pos */
|
||||||
if (server.current_client != NULL && c->qb_pos) {
|
if (!fFreed && c->qb_pos) {
|
||||||
sdsrange(c->querybuf,c->qb_pos,-1);
|
sdsrange(c->querybuf,c->qb_pos,-1);
|
||||||
c->qb_pos = 0;
|
c->qb_pos = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user