title: Is it safe to use realloc?
body: <p>Some time ago a friend of mine told me not to use <code>realloc</code> because it's unsafe, but he couldn't tell me why, so I made some research on the subject and the nearest references to my doubt were:</p>
  <ol>
  <li><a href="https://buildsecurityin.us-cert.gov/bsi/articles/knowledge/coding/809-BSI.html" rel="nofollow noreferrer">First</a></li>
  <li><a href="http://www.iso-9899.info/wiki/Why_not_realloc" rel="nofollow noreferrer">Second</a></li>
  </ol>
  <p>I want to know if I can continue to use <code>realloc </code>in my code or if it's unsafe is there any other way to reallocate memory?</p>