Add comment to avoid mistake later, remove alloca

    * Add comments so previous mistake is not repeated.
    * Remove alloca, replace it by strdup/asprintf.

Code now passes cppcheck.