Question: In the following code, what is the first line that introduces a memory leak into the program? (Type the line number into the box below.)

In the following code, what is the first line that introduces a memory leak into the program? (Type the line number into the box below.)

1: #include 2: #include 3: 4: int main(void) 5: { 6: int *numbers1 = NULL; 7: int *numbers2; 8: 9: numbers1 = malloc(sizeof(int)); 10: numbers2 = malloc(sizeof(int) * 12); 11: 12: *numbers1 = 0; 13: numbers2 = numbers1; 14: numbers1 = malloc(sizeof(int) * 40); 15: 16: return 0; 17: }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!