bugoftheweek

Bug of the week - List of all bugs and its solutions

Job Opening: QA Manager - Software Testing

Dear c4swimmers,

We have some urgent requirements with our Client in India.

About Client: It’s a Fortune 25 top Software MNC with Multiple offices across USA, UK and India.
Current open requirements are for INDIA office.

If you feel you are fitting to any of position below send your updated resume, and contact details to swiftsol.consultant@gmail.com

Position: Manager – Quality Engineering

Job Experience: 8 - 15 yrs in software QE
Job Function: Lead Quality Assurance Team
Location: Northern Part of India

Link - Debugging Unix processes: A Detective Story

Debugging Unix processes: A Detective Story

http://www.zip.com.au/~dtucker/rc-debug/

Bug of the week - Memory allocation conflict

Find the bug in the following code snippet related to memory allocation conflict.

/* File: newfree.cpp */

#include <iostream.h>
#include <stdlib.h>
int main()
{
char *ptr;
ptr = new char;
free(ptr);
return 0;
}

Solution:
Here memory was allocated with new operator and an attempt was made to free it with free which is not a good programming practice. It could lead to portability problems.

Use delete(ptr); instead of free(ptr); since the memory is allocated with new operator.

Note: Always use new with delete and malloc with free

Syndicate content