cid 12135/12134 - fix error state for allocating memory in pdf parsing

pull/8/merge
Kevin Lin 10 years ago
parent f8f2ff9480
commit 76c9c9ddb5
  1. 8
      libclamav/pdfng.c

@ -504,8 +504,14 @@ char *pdf_parse_string(struct pdf_struct *pdf, struct pdf_obj *obj, const char *
res = pdf_finalize_string(pdf, obj, begin, objsize2);
if (!res) {
res = cli_calloc(1, objsize2+1);
if (!(res))
if (!(res)) {
close(fd);
cli_unlink(newobj->path);
free(newobj->path);
newobj->path = NULL;
free(begin);
return NULL;
}
memcpy(res, begin, objsize2);
res[objsize2] = '\0';

Loading…
Cancel
Save