If fdopen(3) fails then ctx->output_file is NULL and should not be used
in cleanup_test_output() called next.
Problem detected by the Coverity tool
CID 1042543 (#1 of 1): Dereference after null check (FORWARD_NULL)9.
var_deref_model: Passing "ctx" to function
"cleanup_test_output(libusbx_testlib_ctx *)", which dereferences null
"ctx->output_file".
-#define LIBUSB_NANO 10842
+#define LIBUSB_NANO 10843
}
ctx->output_file = fdopen(ctx->old_stdout, "w");
if (!ctx->output_file) {
+ ctx->output_file = stdout;
cleanup_test_output(ctx);
printf("Failed to open FILE for output handle: %d\n", errno);
return 1;