I don't have much context of what is going on here, but this looks like a memory leak in a loop to me: insert_vm_query_values is overwritten (both in i==0 and else branches) without freeing it's previous value. It's probably a good idea to rewrite this bit of code anyway with fewer string copies.
While reviewing static analysis reports on some CheriBSD ports, I came across this code:
I don't have much context of what is going on here, but this looks like a memory leak in a loop to me:
insert_vm_query_values
is overwritten (both ini==0
andelse
branches) without freeing it's previous value. It's probably a good idea to rewrite this bit of code anyway with fewer string copies.