summaryrefslogtreecommitdiff
path: root/sql/net_serv.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2021-07-16 22:12:09 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2021-07-16 22:12:09 +0200
commite7f4daf88c4348bb018d04d298b104617554f310 (patch)
tree8cb54b53e75db7fa848ad93c4a3640736116c97e /sql/net_serv.cc
parent461cac890170c8a903972d4c8e6f4576cf8558e6 (diff)
parentfc2ec25733c6f1a305bf14df960ee7a02b48ef2c (diff)
downloadmariadb-git-e7f4daf88c4348bb018d04d298b104617554f310.tar.gz
merge 10.5 to 10.6
Diffstat (limited to 'sql/net_serv.cc')
-rw-r--r--sql/net_serv.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 8b0f1eed46d..39b4290a161 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -179,14 +179,26 @@ my_bool my_net_init(NET *net, Vio *vio, void *thd, uint my_flags)
DBUG_RETURN(0);
}
+
+/**
+ Allocate and assign new net buffer
+
+ @note In case of error the old buffer left
+
+ @retval TRUE error
+ @retval FALSE success
+*/
+
my_bool net_allocate_new_packet(NET *net, void *thd, uint my_flags)
{
+ uchar *tmp;
DBUG_ENTER("net_allocate_new_packet");
- if (!(net->buff=(uchar*) my_malloc(key_memory_NET_buff,
- (size_t) net->max_packet +
- NET_HEADER_SIZE + COMP_HEADER_SIZE + 1,
- MYF(MY_WME | my_flags))))
+ if (!(tmp= (uchar*) my_malloc(key_memory_NET_buff,
+ (size_t) net->max_packet +
+ NET_HEADER_SIZE + COMP_HEADER_SIZE + 1,
+ MYF(MY_WME | my_flags))))
DBUG_RETURN(1);
+ net->buff= tmp;
net->buff_end=net->buff+net->max_packet;
net->write_pos=net->read_pos = net->buff;
DBUG_RETURN(0);