Fix some coverity-reported issues.

This commit is contained in:
Michael R Sweet 2021-06-09 09:14:57 -04:00
parent b005175003
commit 63c0fc1926
No known key found for this signature in database
GPG Key ID: BE67C75EC81F3244
2 changed files with 15 additions and 5 deletions

View File

@ -402,7 +402,8 @@ _pdfioDictRead(pdfio_file_t *pdf, // I - PDF file
PDFIO_DEBUG("_pdfioDictRead(pdf=%p)\n", pdf);
// Create a dictionary and start reading...
dict = pdfioDictCreate(pdf);
if ((dict = pdfioDictCreate(pdf)) == NULL)
return (NULL);
while (_pdfioTokenGet(tb, key, sizeof(key)))
{

View File

@ -388,15 +388,19 @@ pdfioFileCreatePage(pdfio_file_t *pdf, // I - PDF file
pdfioDictSetName(dict, "Type", "Page");
// Create the page object...
page = pdfioFileCreateObj(pdf, dict);
if ((page = pdfioFileCreateObj(pdf, dict)) == NULL)
return (NULL);
// Create a contents object to hold the contents of the page...
contents_dict = pdfioDictCreate(pdf);
if ((contents_dict = pdfioDictCreate(pdf)) == NULL)
return (NULL);
#ifndef DEBUG
pdfioDictSetName(contents_dict, "Filter", "FlateDecode");
#endif // !DEBUG
contents = pdfioFileCreateObj(pdf, contents_dict);
if ((contents = pdfioFileCreateObj(pdf, contents_dict)) == NULL)
return (NULL);
// Add the contents stream to the pages object and write it...
pdfioDictSetObj(dict, "Contents", contents);
@ -1372,7 +1376,12 @@ write_trailer(pdfio_file_t *pdf) // I - PDF file
close(fd);
}
pdf->trailer = pdfioDictCreate(pdf);
if ((pdf->trailer = pdfioDictCreate(pdf)) == NULL)
{
ret = false;
goto done;
}
if (pdf->encrypt)
pdfioDictSetObj(pdf->trailer, "Encrypt", pdf->encrypt);
if (pdf->id_array)