SipRtcProxy icon indicating copy to clipboard operation
SipRtcProxy copied to clipboard

Remove unnecessary null pointer checks

Open elfring opened this issue 5 years ago • 1 comments
trafficstars

An extra null pointer check is not needed in functions like the following.

elfring avatar Aug 26 '20 16:08 elfring

Thanks, it's will be modified soon. Free(NULL); same as delete NULL; I didn't think about it before.

**Description The C library function void free(void ptr) deallocates the memory previously allocated by a call to calloc, malloc, or realloc. Declaration Following is the declaration for free() function. void free(void ptr) Parameters ptr —— This is the pointer to a memory block previously allocated with malloc, calloc or realloc to be deallocated. If a null pointer is passed as argument, no action occurs. Return Value This function does not return any value.

**Description The C++ language guarantees that delete p will do nothing if p is null. Since you might get the test backwards, and since most testing methodologies force you to explicitly test every branch point, you should not put in the redundant if test.

DyncEric avatar Aug 27 '20 02:08 DyncEric