Skip to content
This repository was archived by the owner on Oct 24, 2019. It is now read-only.

Commit d1084c9

Browse files
authored
Update pebble_rpc.cpp
fix getbuff bug
1 parent 9907e9f commit d1084c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/framework/pebble_rpc.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ uint8_t* PebbleRpc::GetBuffer(int32_t size) {
116116
return NULL;
117117
}
118118
// 2 * size or max_buff_size
119-
int32_t need_realloc = std::min(size + size - m_buff_size, max_buff_size - m_buff_size);
119+
int32_t need_realloc = std::min(size + size, max_buff_size);
120120
uint8_t* new_buff = (uint8_t*)realloc(m_buff, need_realloc);
121121
if (new_buff == NULL) {
122122
PLOG_ERROR("realloc failed, buff size %d, realloc size %d", m_buff_size, need_realloc);
123123
return NULL;
124124
}
125125
m_buff = new_buff;
126-
m_buff_size += need_realloc;
126+
m_buff_size = need_realloc;
127127
return m_buff;
128128
}
129129

0 commit comments

Comments
 (0)