LibPng memory allocation error on packaged game

I’m trying to generate a pdf in-game using libharu. When executing in the editor all goes well, but when I package it (both development and shipping modes) and I try to load a png image it crashes for a memory allocation error. However with jpg images it works fine. I’m using different versions of libpng and zlib from those contained in the engine (the last, I think) which I include as static libraries. Executing with administrator privileges doesn’t help.
Could it be that an Unreal game can’t allocate memory with external libraries?