CID 1016715
CID 1016717
Resource leak (RESOURCE_LEAK)17. leaked_storage:
Variable result going out of scope leaks the storage it points to.
The code is somewhat tricky so it's not a good idea
free the variable before the return as we can cause
double free()s; instead free the memory just before
jumping to the label.