You created the zval with `MAKE_STD_ZVAL` but destroy with `zval_dtor`, that will leak the container. You're probably looking for something like this:

    zval tmp_data;
    ZVAL_ZVAL(&tmp_data, (copies && copies[i]) ? copies[i]: stmt->param_bind[i].zv, 1, 0);
    convert_to_double(&tmp_data);
    // ...
    zval_dtor(&tmp_data);

That's the semi-standard approach to performing a cast without touching the zval. The ZVAL_ZVAL is the same as ZVAL_COPY_VALUE+zval_copy_ctor.