In debugging a situation I discovered that the code called av_store() with an element that was already stored in that position. av_store decrements the reference count, destroying what's about to be stored. I know next to nothing about this. Is the attached patch the right way to fix it?