From: Sebastian B. <sb...@us...> - 2013-12-24 09:34:07
|
Update of /cvsroot/simplemail/simplemail In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv1708 Modified Files: imap.c Log Message: Added malloc() success check. Index: imap.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/imap.c,v retrieving revision 1.89 retrieving revision 1.90 diff -u -d -r1.89 -r1.90 --- imap.c 24 Dec 2013 09:33:49 -0000 1.89 +++ imap.c 24 Dec 2013 09:34:04 -0000 1.90 @@ -667,16 +667,18 @@ { int pos = 0; - headers = malloc(todownload+1); - headers[todownload]=0; - - while (todownload) + if ((headers = malloc(todownload+1))) { - int dl; - dl = tcp_read(conn,headers + pos,todownload); - if (dl == -1 || !dl) break; - todownload -= dl; - pos += dl; + headers[todownload]=0; + + while (todownload) + { + int dl; + dl = tcp_read(conn,headers + pos,todownload); + if (dl == -1 || !dl) break; + todownload -= dl; + pos += dl; + } } } } |