title: shall I delete smart pointer manually?
body: <p>This might be a dumb question but I'm just not sure about the answer. The following code read a file, and for each line of the file, a smart pointer is created by "new". If the smart pointer will be used in the future, it's stored in a list, otherwise it's not stored. </p>
  
  <p>My question is that: if the smart pointer is not stored, will that cause potential memory leak? Thank you.</p>
  
  <pre><code>int main(){
      .....;
      std::list&lt;SomeClass&gt; aList;
      while(inFile &gt;&gt; ss){
           std::tr1::shared_ptr&lt;SomeClass&gt; aPtr(new SomeClass());
           //do something in foo(aPtr) to aPtr, 
           //if aPtr will be used later, then it's stored in aList
           //otherwise, it's not stored
           foo(aPtr);
      }
      .....;
  }
  </code></pre>