There are several repeats of common clean-up code.  Consider re-writing the {...} block that you've included purely to scope existing_info_size as a do { ... } while (0); so that failure cases can simply break; out of it to land in the common clean-up after it; then the last thing inside that block can be the Log() and WriteDB() that constitute success.  The failures break past that and everyone ends up in one copy of the clean-up.