[xml] Some things about xmlCharEncodingHandler

I recognised several things about xmlCharEncodingHandlers.

First, you only register a handler, you can't unregister it. It makes
sense, because as I see from the source there is no
syncronisation/protection of the handlers, so you can't assure, that
it's not in use at the moment you would try to free it.

Another thing is, that you can register several handlers with the same
name. And when you try to find a specific handler you only get the first
registered one with the name. Maybe there should be a check to prevent
more than one handler with the same name.

I also recognised, that in the function xmlFindCharEncodingHandler() in
encoding.c the parameter "const char *name" is changed in the function.
The pointer will be set to the returning pointer of
xmlGetEncodingAlias(). IMO it should not be altered, because you might
want to use that var in the calling function with the (maybe wrong)
name. And I guess it causes a little memory leak. After the
xmlGetEncodingAlias call the var "nalias" should be used and "nalias"
set to name if the result was NULL.

So long

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]