Answer to Question #205228 in C for Tom Boyle

Question #205228

In the buffer code, identify the problems if:

(a) You do not use a temporary variable to realloc buffer;

(b) You do not test the buffer before each function.

(c) You do not free the memory in case of error


1
Expert's answer
2021-06-13T00:03:41-0400

a) There will be undefined behavior because there is memory violation and invalid memory access.

b) There might be a buffer overflow because the function can try to store more data in the buffer than the buffer can hold.

c) There can be leaking of resources or mutex leaking if the operating system does not clean up the memory.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS