cl.hpp resource leaks (memory leaks) (but not too important).

In some places cl.hpp file the vector assignment has been used (for example in createKernels method [STRIKE]or getSubDevices[/STRIKE]). In cl::Program::createKernels method I found trivial bug (caused by using wrong type in temporary array).
Ofcourse a retaining and releasing works properly, however a vector assignment (with [STRIKE] type promotions[/STRIKE] using operator=) generates extraneous reference count if array of objects will be assigned.
Because temporary array is allocated with using alloca (not with new operator) and this is array of cl::Kernel (not cl_kernel_id) objects, extranenous references will not be released.
Final reason of resource leaks is cl::Kernel in temporary array (should be cl_kernel) causes resource leaks.

Relevant code from cl.hpp:


cl_int createKernels(VECTOR_CLASS<Kernel>* kernels)
    {
        cl_uint numKernels;
        cl_int err = ::clCreateKernelsInProgram(object_, 0, NULL, &numKernels);
        if (err != CL_SUCCESS) {
            return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
        }

        Kernel* value = (Kernel*) alloca(numKernels * sizeof(Kernel));
        /* ^ SHOULD BE cl_kernel* value = (cl_kernel*)alloca( ... */
        err = ::clCreateKernelsInProgram(
            object_, numKernels, (cl_kernel*) value, NULL);
        if (err != CL_SUCCESS) {
            return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
        }
        kernels->assign(&value[0], &value[numKernels]);
        /* how to fix use new operator or release manually with clReleaseKernel */
        return CL_SUCCESS;
    }

Regards matszpk

Sorry for my english, I am still learning.

EDIT: Sorry for first version of the post: I wrote post quickly without considering real reason of a resource leak.
Finally reason is wrong type of temporary array in createKernels method. Ofcourse assignment of raw OpenCL ids works properly
and will not causes potential resource leaks.