다음을 통해 공유


PREfast Warning 263 (Windows CE 5.0)

Send Feedback

263 - Using _alloca in a loop.
Consequence: This can quickly overflow stack.

This warning indicates that a call to _alloca was detected in a loop.

_alloca allocates from the stack but is only freed when the calling function exits. _alloca should not be used in loops unless the size of the allocation and iteration counts are well understood and small.

Example

Defective Source

char *b;

do {
    b = (char *)_alloca(9);

    ;
    
} while (1);

Corrected Source

char *b;

do {
    b = (char *)malloc(9);

    if (b == NULL) {
        break;
    }

    ;

    free(b);
} while (1);

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.