@@ -429,17 +429,16 @@ void cares_wrap_hostent_cpy(struct hostent* dest, struct hostent* src) {
429429
430430 /* copy `h_aliases` */
431431 size_t alias_count;
432- size_t cur_alias_length;
433432 for (alias_count = 0 ;
434433 src->h_aliases [alias_count] != nullptr ;
435434 alias_count++) {
436435 }
437436
438437 dest->h_aliases = node::Malloc<char *>(alias_count + 1 );
439438 for (size_t i = 0 ; i < alias_count; i++) {
440- cur_alias_length = strlen (src->h_aliases [i]);
441- dest->h_aliases [i] = node::Malloc (cur_alias_length + 1 );
442- memcpy (dest->h_aliases [i], src->h_aliases [i], cur_alias_length + 1 );
439+ const size_t cur_alias_size = strlen (src->h_aliases [i]) + 1 ;
440+ dest->h_aliases [i] = node::Malloc (cur_alias_size );
441+ memcpy (dest->h_aliases [i], src->h_aliases [i], cur_alias_size );
443442 }
444443 dest->h_aliases [alias_count] = nullptr ;
445444
@@ -1065,7 +1064,6 @@ int ParseSoaReply(Environment* env,
10651064 /* Can't use ares_parse_soa_reply() here which can only parse single record */
10661065 unsigned int ancount = cares_get_16bit (buf + 6 );
10671066 unsigned char * ptr = buf + NS_HFIXEDSZ;
1068- int rr_type, rr_len;
10691067 char * name;
10701068 char * rr_name;
10711069 long temp_len; // NOLINT(runtime/int)
@@ -1094,8 +1092,8 @@ int ParseSoaReply(Environment* env,
10941092 break ;
10951093 }
10961094
1097- rr_type = cares_get_16bit (ptr);
1098- rr_len = cares_get_16bit (ptr + 8 );
1095+ const int rr_type = cares_get_16bit (ptr);
1096+ const int rr_len = cares_get_16bit (ptr + 8 );
10991097 ptr += NS_RRFIXEDSZ;
11001098
11011099 /* only need SOA */
0 commit comments