diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2021-07-16 22:12:09 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2021-07-16 22:12:09 +0200 |
commit | e7f4daf88c4348bb018d04d298b104617554f310 (patch) | |
tree | 8cb54b53e75db7fa848ad93c4a3640736116c97e /sql/net_serv.cc | |
parent | 461cac890170c8a903972d4c8e6f4576cf8558e6 (diff) | |
parent | fc2ec25733c6f1a305bf14df960ee7a02b48ef2c (diff) | |
download | mariadb-git-e7f4daf88c4348bb018d04d298b104617554f310.tar.gz |
merge 10.5 to 10.6
Diffstat (limited to 'sql/net_serv.cc')
-rw-r--r-- | sql/net_serv.cc | 20 |
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); |