... | ... |
@@ -504,8 +504,14 @@ char *pdf_parse_string(struct pdf_struct *pdf, struct pdf_obj *obj, const char * |
504 | 504 |
res = pdf_finalize_string(pdf, obj, begin, objsize2); |
505 | 505 |
if (!res) { |
506 | 506 |
res = cli_calloc(1, objsize2+1); |
507 |
- if (!(res)) |
|
507 |
+ if (!(res)) { |
|
508 |
+ close(fd); |
|
509 |
+ cli_unlink(newobj->path); |
|
510 |
+ free(newobj->path); |
|
511 |
+ newobj->path = NULL; |
|
512 |
+ free(begin); |
|
508 | 513 |
return NULL; |
514 |
+ } |
|
509 | 515 |
memcpy(res, begin, objsize2); |
510 | 516 |
res[objsize2] = '\0'; |
511 | 517 |
|