Commit 5dcab07c authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

if a malloc fails, clear up the memory and return failure

parent 1f798aff
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -705,6 +705,16 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
             /* point the main to us */
             mainco = newco;
           }
           else {
              /* failure, clear up the allocated chain and return NULL */
             while(mainco) {
               co = mainco->next;
               free(mainco);
               mainco = co;
             }

             return NULL;
           }
         }
       }
     }