I see this way too often in the codebase I'm currently working in:
int obtained_number = 5;
char *answer = tpalloc(15);
sprintf(answer, "num:%d", obtained_number);
tpreturn(TPSUCCESS, 0, answer, answerSize, 0);
tpfree(answer);//why?
According to the documentation:
tpreturn() acts like a return statement in the C language (that is, when tpreturn() is called, the service routine returns to the BEA Tuxedo system dispatcher).
If this is so, I guess the service finishes at that point and tpfree()
is never called. When the service is called again, it starts in the main method again, instead of where the execution finished last time.
Is this correct? Should I report this unnecesary use of tpfree()
?