In some open source C code, I found a function that (I think) is assigning a pointer to point to an automatic variable which won't exist once the pointer is utilized:
static void TableCopy(void *tableBaseAddr, const unsigned int **tableOut, unsigned int *tableLengthOut)
{
    //First word in table is size
    unsigned int tableSize = ((unsigned int*)(tableBaseAddr))[0];
    //Read each word from the table and store in an array
    unsigned int tmpTable[tableSize];
    unsigned int i;        
    for (i = 0; i < tableSize; i++)
    {
        tmpTable[i] = ((unsigned int*)(tableBaseAddr))[i];
    }
    //Assign outputs
    *tableOut = tmpTable;   //Passing back the pointer to an automatic variable?
    *tableLengthOut = tableSize;
}
I couldn't think of a reason you would ever intentionally do this. Am I correct in that this code is doing something bad, or is there a possible reason you would do this?
