dataToWrite is leaked on all those wonderful |if (NS_FAILED(rv)) return rv;| blocks that come after it has been allocated. If we're dealing with non-text data, dataBuffer is leaked as well.
Comment on attachment 79735 [details] [diff] [review] Patch v1.0 Index: protocol/data/src/nsDataChannel.cpp >@@ -204,12 +211,18 @@ >+ // XXX PL_Base64Decode will return a null pointer for decoding >+ // errors. Since those are more likely than out-of-memory, >+ // should we return NS_ERROR_MALFORMED_URI instead? how about NS_ERROR_UNEXPECTED? nice work! sr=darin
Checked in on trunk, with NS_ERROR_UNEXPECTED as the error.
This does not build on Windows, apparently. I backed it out and will work on a different fix.
OK, this builds on windows if I move the PRUint32 dataLen = PL_strlen(dataBuffer); line to before the goto that's above it. So I'll be relanding this with that change...
Verified per bzbarsky's comments.