| From: Pranav Batra <batrapranav@chromium.org> |
| Ghostscript-Bug-URL: https://bugs.ghostscript.com/show_bug.cgi?id=702586 |
| Chromium-Bug-URL: https://crbug.com/1085945 |
| Subject: [PATCH] Fix memory leak |
| |
| A reference-counted icc device profile object was not decremented before |
| being overwritten, leading to a memory leak. |
| |
| --- a/base/gdevp14.c |
| +++ b/base/gdevp14.c |
| @@ -5658,6 +5658,8 @@ pdf14_update_device_color_procs(gx_device *dev, |
| /* iccprofile was incremented above if we had not just created it. |
| When we do the pop we will decrement and if we just created it, it |
| will be destroyed */ |
| + if (dev->icc_struct->device_profile[0]) |
| + gsicc_adjust_profile_rc(dev->icc_struct->device_profile[0], -1, "pdf14_update_device_color_procs"); |
| dev->icc_struct->device_profile[0] = iccprofile; |
| } |
| return 1; /* Lets us detect that we did do an update */ |