Skip to content

scene: rework some error handling

Lyndon Brown requested to merge jnqnfe/vlc:if23 into master

primarily to fix use and free of invalid pointers upon failed asprintf()s. also, improved error messages.

  • if the asprintf() for psz_filename failed, it incorrectly tried to use this variable in the error message, before then trying to free() it. also the error message mislead the user that it failed to create the file on the filesystem rather than encountered a memory allocation error.
  • if the asprintf() for psz_temp failed (appending .swp to psz_filename for a temporary file location), it used it incorrectly in the same way. also again the error message output mislead the user in the same way.
  • the error message output when actually creating the file at the temporary location failed, the text risked confusing users in that it made no reference to this being a temporary location rather than the final destination.
  • similarly the error text from failing to rename from the temp filename to the final one was also potentially a little confusing to users.
  • the final goto error: was pointless since it just falls through to the same place.

use of the error: goto has been dropped entirely to avoid unnecessary free() calls in fixing the above.

Split from !1085 (closed).

Merge request reports