Github user PSUdaemon commented on a diff in the pull request: https://github.com/apache/trafficserver/pull/738#discussion_r68431089 --- Diff: plugins/experimental/remap_stats/remap_stats.c --- @@ -92,19 +92,19 @@ stat_add(char *name, TSMgmtInt amount, TSStatPersistence persist_type, TSMutex c static char * get_effective_host(TSHttpTxn txn) { - char *effective_url, *tmp; const char *host; int len; TSMBuffer buf; TSMLoc url_loc; - effective_url = TSHttpTxnEffectiveUrlStringGet(txn, &len); - buf = TSMBufferCreate(); + buf = TSMBufferCreate(); if (TS_SUCCESS != TSUrlCreate(buf, &url_loc)) { TSDebug(DEBUG_TAG, "unable to create url"); + TSMBufferDestroy(buf); return NULL; } - tmp = effective_url; + char *effective_url, *tmp; --- End diff -- Why are we moving this down here? Since it's stack allocated the compiler won't care that you put it after the `if` above. Really all we want to avoid is making the call to `TSHttpTxnEffectiveUrlStringGet` which will heap alloc the memory pointed to by `effective_url`.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---