Re:Pointers and memory leaks in C
by galapago on Friday October 10, 2014 @01:27PM
(#8438992)
> memset(p,’\0’,10);
[ Parent
| on HN ]
Re:Pointers and memory leaks in C
by AlexeyBrin on Friday October 10, 2014 @01:47PM
(#8439088)
I think you should read the above as:
memset(p, '\0', 10);
Probably best approach is to always use calloc, unless you fill the buffer yourself with other meaningful values immediately after allocation.