unsigned char *bin_data;
unsigned char *bin_model;
bin_data = new unsigned char[200];
memset(bin_data, 0, 200);
bin_model = new unsigned char[200];
memset(bin_model, 0, 200);
I was reviewing the code above and I have a gut feel that it might cause a memory leak, but I logically cannot find the reason.
I am thinking it is because we have memset a pointer to 0, the address of the data might be lost. What we wanted to do was just to initialize bin_data and bin_model before acquiring data from an interface which will be used in further processing, since acquiring the data has a chance to fail.
Will the code above cause any problems?
Thanks!