[Live-devel] Segmentation fault in DelayQueue::removeEntry(DelayQueueEntry*)
Ross Finlayson
finlayson at live555.com
Fri Nov 4 07:10:39 PDT 2011
> Looking at the code here http://www.live555.com/liveMedia/doxygen/html/DelayQueue_8cpp-source.html I see this:
>
> 00153 void DelayQueue::removeEntry(DelayQueueEntry* entry) {
> 00154 if (entry == NULL || entry->fNext == NULL) return;
> 00155
> 00156 entry->fNext->fDeltaTimeRemaining += entry->fDeltaTimeRemaining;
> 00157 entry->fPrev->fNext = entry->fNext;
> 00158 entry->fNext->fPrev = entry->fPrev;
> 00159 entry->fNext = entry->fPrev = NULL;
> 00160 // in case we should try to remove it again
> 00161 }
>
> I think the first if could produce a wrong memory access if entry is NULL. Is that correct?
No, because the statement at line 154 quite clearly tests for "entry == NULL", and returns if it is.
The "DelayQueue" code is very widely used and has been tested for a long time, so I don't understand why you would be seeing an error there. (I hope you're not doing something stupid like trying to use multiple threads?)
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20111104/4e3b3e08/attachment-0001.html>
More information about the live-devel
mailing list