- avoid discarding the value of i_io_getc() when scanning numbers in
pnm.c. CID 185293.
+ - handle failure to clone the log filehandle when cloning the Imager
+ context object on thread creation. CID 185294.
+
[1] The first two build submissions ended up at the end of a ~400
build queue, and seemed to have been cancelled by Coverity. A build
submitted on NYE went through in minutes.
/* the following sv_setref_pv() will free this inc */
im_context_refinc(MY_CXT.ctx, "CLONE");
MY_CXT.ctx = im_context_clone(MY_CXT.ctx, "CLONE");
+ if (MY_CXT.ctx == NULL) {
+ croak("Failed to clone Imager context");
+ }
sv_setref_pv(get_sv("Imager::_context", GV_ADD), "Imager::Context", MY_CXT.ctx);
#endif
if (ctx->lg_file) {
if (ctx->own_log) {
int newfd = dup(fileno(ctx->lg_file));
- nctx->own_log = 1;
- nctx->lg_file = fdopen(newfd, "w");
- if (nctx->lg_file)
- setvbuf(nctx->lg_file, NULL, _IONBF, BUFSIZ);
+ if (newfd >= 0) {
+ nctx->own_log = 1;
+ nctx->lg_file = fdopen(newfd, "w");
+ if (nctx->lg_file)
+ setvbuf(nctx->lg_file, NULL, _IONBF, BUFSIZ);
+ }
+ else {
+#ifdef IMAGER_TRACE_CONTEXT
+ perror("im_context:failed to clone log");
+#endif
+ free(nctx->slots);
+ free(nctx);
+ return NULL;
+ }
}
else {
/* stderr */