diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2018-11-17 10:00:32 +0000 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2018-11-19 09:50:17 +0000 |
commit | cb9bb72643e95383bcacd88ab718565f3df9a510 (patch) | |
tree | 9a43303c1ac57e9af42b6c6112ecda7794617045 | |
parent | c69827c308b608719d786fc14c8518af4dd6b335 (diff) | |
download | ghostpdl-cb9bb72643e95383bcacd88ab718565f3df9a510.tar.gz |
Coverity ID 94865
This had already been tackled, but it turns out there were a couple
more places where tempnames wasn't freed, but Coverity only seems to
flag them one at a time.
-rw-r--r-- | psi/imain.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/psi/imain.c b/psi/imain.c index a4a9917d0..fc5bbc2e5 100644 --- a/psi/imain.c +++ b/psi/imain.c @@ -874,7 +874,7 @@ gs_main_finit(gs_main_instance * minst, int exit_status, int code) gs_dual_memory_t dmem = {0}; int exit_code; ref error_object; - char *tempnames; + char *tempnames = NULL; /* NB: need to free gs_name_table */ @@ -950,7 +950,10 @@ gs_main_finit(gs_main_instance * minst, int exit_status, int code) with the default device. */ int code = gs_grestoreall(i_ctx_p->pgs); - if (code < 0) return_error(gs_error_Fatal); + if (code < 0) { + free(tempnames); + return_error(gs_error_Fatal); + } } if (i_ctx_p->pgs != NULL && i_ctx_p->pgs->device != NULL) { @@ -964,8 +967,10 @@ gs_main_finit(gs_main_instance * minst, int exit_status, int code) * Register the device as a gc 'root' so it will be implicitely marked by garbager, and * and thus surive until control returns here. */ - if (gs_register_struct_root(pdev->memory, &dev_root, (void **)&pdev, "gs_main_finit") < 0) + if (gs_register_struct_root(pdev->memory, &dev_root, (void **)&pdev, "gs_main_finit") < 0) { + free(tempnames); return_error(gs_error_Fatal); + } /* make sure device doesn't isn't freed by .uninstalldevice */ rc_adjust(pdev, 1, "gs_main_finit"); |