mod_apache memory leaks + fix + FCGIMessage.java protocol handler fix
Jason Venner (jason@idiom.com)
Fri, 30 May 1997 10:20:59 -0700
Message-Id: <199705301721.KAA26039@idiom.com>
To: fastcgi-developers@OpenMarket.com
Subject: mod_apache memory leaks + fix + FCGIMessage.java protocol handler fix
Date: Fri, 30 May 1997 10:20:59 -0700
From: Jason Venner <jason@idiom.com>
FcgiCleanUp doesn't free the TString structures (DStringFree frees
the contents, but not the structure)
so after the
DStringFree(infoPtr->header)
DStringFree(infoPtr->errorOut)
you need to add
Free( infoPtr->header );
Free( infoPtr->errorOut );
{I can't post a diff as we have other changes in that I can't post}
Replace the function processHeaderBytes with the following and you can
have environment variables passed that are longer than 256 bytes.
private int noSignExtend( byte value )
{
byte ovalue = value;
boolean bit8;
if( (value & 0x80) != 0 ) {
bit8 = true;
} else {
bit8 = false;
}
value &= ~0x80; // mask off the high byte
int result = value;
if( bit8 ) {
result |= 0x80;
}
return result;
}
private int makeInt( byte highb, byte lowb )
{
int result;
int high = noSignExtend(highb);
int low = noSignExtend(lowb);
if( high != 0 ) {
result = (high << 8) | low;
result &= 0xffff;
} else {
result = low;
result &= 0xff;
}
return result;
}
// We never allow sign extension here
private void processHeaderBytes(byte[] hdrBuf) {
h_version = (int)hdrBuf[0] & 0x000000ff;
h_type = (int)hdrBuf[1] & 0x000000ff;
h_requestID = makeInt( hdrBuf[2], hdrBuf[3] );
h_contentLength = makeInt( hdrBuf[4], hdrBuf[5] );
h_paddingLength = (int)hdrBuf[6] & 0x000000ff;
h_reserved = (int)hdrBuf[7] & 0x000000ff;
}