Static analysis produces false positive double free error

The error: c-toxcore - Codacy - Files

Here’s what the man page for realloc says:

The realloc() function returns a pointer to the newly allocated memory, which is suit‐ably aligned for any built-in type and may be different from ptr, or NULL if the request fails. If size was equal to 0, either NULL or a pointer suitable to be passed to free() is returned. If realloc() fails, the original block is left untouched; it is not freed or moved.

Therefore this double free could only occur if the call to realloc succeeds, but zero is passed to the size argument, which is impossible.

The above link no longer works. Here’s a permanent link to the line in question: toxcore/group_moderation.c at 3ffcc0616dd14b90c1283896cd2751cdc4960e8d · JFreegman/toxcore · GitHub