Ticket #94 (closed defect: fixed)
getStatus function returns object allocated on the stack
Reported by: | Knut Landmark | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | zoo-kernel | Version: | |
Keywords: | Cc: |
Description
In the Windows version of the char* getStatus function (service_internal.c), the array
char lpszBuf[SHMEMSIZE];
is allocated on the stack, and then returned by casting lpszBuf to (char *). This may (and does) cause unexpected behavior (segmentation fault) because the stack memory for getStatus is automatically freed when the function returns. One solution is to allocate memory for lpszBuf dynamically using malloc (can be freed after each call to getStatus).
Change History
Note: See
TracTickets for help on using
tickets.