diff --git a/plugins/s3_auth/s3_auth.cc b/plugins/s3_auth/s3_auth.cc index d8d82449a56..3f47d8c6925 100644 --- a/plugins/s3_auth/s3_auth.cc +++ b/plugins/s3_auth/s3_auth.cc @@ -722,6 +722,7 @@ S3Request::set_header(const char *header, int header_len, const char *val, int v bool first = true; while (field_loc) { + tmp = TSMimeHdrFieldNextDup(_bufp, _hdr_loc, field_loc); if (first) { first = false; if (TS_SUCCESS == TSMimeHdrFieldValueStringSet(_bufp, _hdr_loc, field_loc, -1, val, val_len)) { @@ -730,7 +731,6 @@ S3Request::set_header(const char *header, int header_len, const char *val, int v } else { TSMimeHdrFieldDestroy(_bufp, _hdr_loc, field_loc); } - tmp = TSMimeHdrFieldNextDup(_bufp, _hdr_loc, field_loc); TSHandleMLocRelease(_bufp, _hdr_loc, field_loc); field_loc = tmp; }