Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions iocore/cache/CacheHosting.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,18 +490,14 @@ CacheHostRecord::Init(matcher_line *line_info, CacheType typ)
const char *errptr = "A volume number expected";
RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d :%s", "[CacheHosting]", config_file,
line_info->line_num, errptr);
if (val != nullptr) {
ats_free(val);
}
ats_free(val);
return -1;
}
}
if ((*s < '0') || (*s > '9')) {
RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : bad token [%c]", "[CacheHosting]",
config_file, line_info->line_num, *s);
if (val != nullptr) {
ats_free(val);
}
ats_free(val);
return -1;
}
s++;
Expand Down Expand Up @@ -537,9 +533,7 @@ CacheHostRecord::Init(matcher_line *line_info, CacheType typ)
if (!is_vol_present) {
RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : bad volume number [%d]",
"[CacheHosting]", config_file, line_info->line_num, volume_number);
if (val != nullptr) {
ats_free(val);
}
ats_free(val);
return -1;
}
if (c == '\0') {
Expand Down
6 changes: 3 additions & 3 deletions iocore/cache/P_CacheInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,9 @@ free_CacheVC(CacheVC *cont)
cont->blocks.clear();
cont->writer_buf.clear();
cont->alternate_index = CACHE_ALT_INDEX_DEFAULT;
if (cont->scan_vol_map) {
ats_free(cont->scan_vol_map);
}

ats_free(cont->scan_vol_map);

memset((char *)&cont->vio, 0, cont->size_to_init);
#ifdef CACHE_STAT_PAGES
ink_assert(!cont->stat_link.next && !cont->stat_link.prev);
Expand Down
9 changes: 4 additions & 5 deletions iocore/net/ALPNSupport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@ ALPNSupport::unbind(SSL *ssl)
void
ALPNSupport::clear()
{
if (npn) {
ats_free(npn);
npn = nullptr;
npnsz = 0;
}
ats_free(npn);
npn = nullptr;
npnsz = 0;

npnSet = nullptr;
npnEndpoint = nullptr;
}
Expand Down
19 changes: 6 additions & 13 deletions iocore/net/OCSPStapling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,10 @@ certinfo_map_free(void * /*parent*/, void *ptr, CRYPTO_EX_DATA * /*ad*/, int /*i
if (cinf->uri) {
OPENSSL_free(cinf->uri);
}
if (cinf->certname) {
ats_free(cinf->certname);
}
if (cinf->user_agent) {
ats_free(cinf->user_agent);
}

ats_free(cinf->certname);
ats_free(cinf->user_agent);

ink_mutex_destroy(&cinf->stapling_mutex);
OPENSSL_free(cinf);
}
Expand Down Expand Up @@ -295,13 +293,8 @@ ssl_stapling_init_cert(SSL_CTX *ctx, X509 *cert, const char *certname, const cha
OCSP_CERTID_free(cinf->cid);
}

if (cinf->certname) {
ats_free(cinf->certname);
}

if (cinf->user_agent) {
ats_free(cinf->user_agent);
}
ats_free(cinf->certname);
ats_free(cinf->user_agent);

if (cinf) {
OPENSSL_free(cinf);
Expand Down
6 changes: 2 additions & 4 deletions iocore/net/SSLNextProtocolSet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ SSLNextProtocolSet::create_npn_advertisement(const SessionProtocolSet &enabled,
const SSLNextProtocolSet::NextProtocolEndpoint *ep;
unsigned char *advertised;

if (*npn) {
ats_free(*npn);
*npn = nullptr;
}
ats_free(*npn);
*npn = nullptr;
*len = 0;

for (ep = endpoints.head; ep != nullptr; ep = endpoints.next(ep)) {
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/UnixUDPNet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ UDPReadContinuation::readPollEvent(int event_, Event *e)
* *actual_len = recvfrom(fd,addr,buf->end(),len)
* if successful then
* buf->fill(*actual_len);
* return ACTION_RESULT_DONE
* return ACTION_RESULT_DONE
* else if nothing read
* *actual_len is 0
* create "UDP read continuation" C with 'cont's lock
Expand Down
6 changes: 3 additions & 3 deletions lib/records/RecCore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -898,9 +898,9 @@ RecRegisterConfig(RecT rec_type, const char *name, RecDataT data_type, RecData d
// Note: do not modify 'record->config_meta.update_required'
r->config_meta.update_type = update_type;
r->config_meta.check_type = check_type;
if (r->config_meta.check_expr) {
ats_free(r->config_meta.check_expr);
}

ats_free(r->config_meta.check_expr);

r->config_meta.check_expr = ats_strdup(check_expr);
r->config_meta.update_cb_list = nullptr;
r->config_meta.access_type = access_type;
Expand Down
4 changes: 1 addition & 3 deletions lib/records/RecUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ RecDataSet(RecDataT data_type, RecData *data_dst, RecData *data_src)
}
} else if (((data_dst->rec_string) && (strcmp(data_dst->rec_string, data_src->rec_string) != 0)) ||
((data_dst->rec_string == nullptr) && (data_src->rec_string != nullptr))) {
if (data_dst->rec_string) {
ats_free(data_dst->rec_string);
}
ats_free(data_dst->rec_string);

data_dst->rec_string = ats_strdup(data_src->rec_string);
rec_set = true;
Expand Down
2 changes: 1 addition & 1 deletion lib/records/test_RecProcess.i
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void RecDumpRecordsHt(RecT rec_type);
do { \
RecString rec_string = 0; \
if (RecGetRecordString_Xmalloc("proxy.config.parse_"name, &rec_string) != REC_ERR_FAIL) { \
if (rec_string) ats_free(rec_string); \
ats_free(rec_string); \
printf(" parse_"name": FAIL\n"); \
failures++; \
} else { \
Expand Down
12 changes: 6 additions & 6 deletions plugins/experimental/memcache/tsmemcache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ MC::die()
if (cbuf) {
free_MIOBuffer(cbuf);
}
if (tbuf) {
ats_free(tbuf);
}

ats_free(tbuf);

mutex = NULL;
theMCAllocator.free(this);
return EVENT_DONE;
Expand Down Expand Up @@ -351,9 +351,9 @@ MC::read_from_client()
cbuf->clear();
}
ink_assert(!crvc && !cwvc);
if (tbuf) {
ats_free(tbuf);
}

ats_free(tbuf);

return TS_SET_CALL(&MC::read_from_client_event, VC_EVENT_READ_READY, rvio);
}

Expand Down
8 changes: 3 additions & 5 deletions proxy/http/HttpSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7316,11 +7316,9 @@ HttpSM::kill_this()

HTTP_SM_SET_DEFAULT_HANDLER(nullptr);

if (redirect_url != nullptr) {
ats_free((void *)redirect_url);
redirect_url = nullptr;
redirect_url_len = 0;
}
ats_free(redirect_url);
redirect_url = nullptr;
redirect_url_len = 0;

#ifdef USE_HTTP_DEBUG_LISTS
ink_mutex_acquire(&debug_sm_list_mutex);
Expand Down
9 changes: 4 additions & 5 deletions proxy/http/remap/RemapConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -899,11 +899,10 @@ process_regex_mapping_config(const char *from_host_lower, url_mapping *new_mappi
return true;

lFail:
if (reg_map->to_url_host_template) {
ats_free(reg_map->to_url_host_template);
reg_map->to_url_host_template = nullptr;
reg_map->to_url_host_template_len = 0;
}
ats_free(reg_map->to_url_host_template);
reg_map->to_url_host_template = nullptr;
reg_map->to_url_host_template_len = 0;

return false;
}

Expand Down
6 changes: 2 additions & 4 deletions proxy/http/remap/UrlMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@ class redirect_tag_str
~redirect_tag_str()
{
type = 0;
if (chunk_str) {
ats_free(chunk_str);
chunk_str = nullptr;
}
ats_free(chunk_str);
chunk_str = nullptr;
}

redirect_tag_str *next = nullptr;
Expand Down
4 changes: 1 addition & 3 deletions proxy/http/remap/UrlRewrite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -957,9 +957,7 @@ UrlRewrite::_destroyList(RegexMappingList &mappings)
RegexMapping *list_iter;
while ((list_iter = mappings.pop()) != nullptr) {
delete list_iter->url_map;
if (list_iter->to_url_host_template) {
ats_free(list_iter->to_url_host_template);
}
ats_free(list_iter->to_url_host_template);
delete list_iter;
}
mappings.clear();
Expand Down
6 changes: 3 additions & 3 deletions proxy/http/remap/unit-tests/nexthop_test_stubs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ build_request(int64_t sm_id, HttpSM *sm, sockaddr_in *ip, const char *os_hostnam
}
sm->t_state.request_data.hdr = new HTTPHdr();
sm->t_state.request_data.hdr->create(HTTP_TYPE_REQUEST, myHeap);
if (sm->t_state.request_data.hostname_str != nullptr) {
ats_free(sm->t_state.request_data.hostname_str);
}

ats_free(sm->t_state.request_data.hostname_str);

sm->t_state.request_data.hostname_str = ats_strdup(os_hostname);
sm->t_state.request_data.xact_start = time(nullptr);
ink_zero(sm->t_state.request_data.src_ip);
Expand Down
5 changes: 2 additions & 3 deletions proxy/http2/Http2Stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,8 @@ Http2Stream::~Http2Stream()
read_vio.mutex.clear();
write_vio.mutex.clear();

if (header_blocks) {
ats_free(header_blocks);
}
ats_free(header_blocks);

_clear_timers();
clear_io_events();
http_parser_clear(&http_parser);
Expand Down
6 changes: 2 additions & 4 deletions proxy/http3/QPACK.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1823,10 +1823,8 @@ QPACK::DynamicTableStorage::DynamicTableStorage(uint16_t size) : _head(size * 2

QPACK::DynamicTableStorage::~DynamicTableStorage()
{
if (this->_data) {
ats_free(this->_data);
this->_data = nullptr;
}
ats_free(this->_data);
this->_data = nullptr;
}

void
Expand Down
18 changes: 8 additions & 10 deletions proxy/logging/LogFormat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,19 @@ LogFormat::init_variables(const char *name, const char *fieldlist_str, const cha
m_agg_marshal_space = static_cast<char *>(ats_malloc(m_field_count * INK_MIN_ALIGN));
}

if (m_name_str) {
ats_free(m_name_str);
m_name_str = nullptr;
m_name_id = 0;
}
ats_free(m_name_str);
m_name_str = nullptr;
m_name_id = 0;

if (name) {
m_name_str = ats_strdup(name);
m_name_id = id_from_name(m_name_str);
}

if (m_fieldlist_str) {
ats_free(m_fieldlist_str);
m_fieldlist_str = nullptr;
m_fieldlist_id = 0;
}
ats_free(m_fieldlist_str);
m_fieldlist_str = nullptr;
m_fieldlist_id = 0;

if (fieldlist_str) {
m_fieldlist_str = ats_strdup(fieldlist_str);
m_fieldlist_id = id_from_name(m_fieldlist_str);
Expand Down
18 changes: 7 additions & 11 deletions src/traffic_server/InkAPI.cc
Original file line number Diff line number Diff line change
Expand Up @@ -850,12 +850,10 @@ FileImpl::fclose()
m_mode = CLOSED;
}

if (m_buf) {
ats_free(m_buf);
m_buf = nullptr;
m_bufsize = 0;
m_bufpos = 0;
}
ats_free(m_buf);
m_buf = nullptr;
m_bufsize = 0;
m_bufpos = 0;
}

ssize_t
Expand Down Expand Up @@ -8209,11 +8207,9 @@ TSHttpTxnRedirectUrlSet(TSHttpTxn txnp, const char *url, const int url_len)

HttpSM *sm = (HttpSM *)txnp;

if (sm->redirect_url != nullptr) {
ats_free(sm->redirect_url);
sm->redirect_url = nullptr;
sm->redirect_url_len = 0;
}
ats_free(sm->redirect_url);
sm->redirect_url = nullptr;
sm->redirect_url_len = 0;

sm->redirect_url = (char *)url;
sm->redirect_url_len = url_len;
Expand Down