My guess without a code example is that you were operating on the buffer or struct you malloc’d with assumptions that its contents would be initialized with certain default values. Malloc doesn’t initialize the memory it hands back, so unless you memset or use some other initialization, the values in that memory could be anything, and therefore, if you’re trying to check a pointer assuming it’d be NULL or that an int will be zero, you can’t make that assumption without initializing the memory first.
1
solved memset after malloc [closed]