[Live-devel] May createNewSomething methods return NULL?
Ross Finlayson
finlayson at live555.com
Mon Sep 12 06:55:53 PDT 2016
> To be honest, I was debugging code that uses exactly that advise from
> that 6-year-old message to limit the number of active sessions (but I
> only discovered that message way later in my debugging). It took me a
> while figuring out that returning NULL from createNewClientSession
> causes createNewClientSessionWithId to insert a NULL session into the
> HashTable fClientSessions.
This is the *first* thing that you should have told us. This told me all that I needed to know: That there was a bug in “GenericMediaServer::createNewClientSessionWithId(). It should have checked that the “createNewClientSession()” result was non-NULL before adding it to the hash table.
I have now installed a new version (2016.09.12) of the “LIVE555 Streaming Media” code that fixes this.
> That is what lead me to the initial question: Is it actually ok for
> createNewClientSession and others to return NULL?
The trouble is - when people ask general questions like this, it’s usually because they’ve earlier run into some more specific issue with the code. It’s generally much more useful to begin by mentioning the specific issue - and only then follow up with the more general question (or perhaps not even ask the more general question at all - as that’s usually my job, not yours :-). That way, we’ll all avoid flailing around needlessly.
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
More information about the live-devel
mailing list