A major purpose of PuTTY's memory-allocation functions is to succeed or die
authorben <ben@cda61777-01e9-0310-a592-d414129be87e>
Sun, 19 Jun 2005 14:17:24 +0000 (14:17 +0000)
committerben <ben@cda61777-01e9-0310-a592-d414129be87e>
Sun, 19 Jun 2005 14:17:24 +0000 (14:17 +0000)
trying, so there's no need to check their return values for NULL.  Spotted
by Ben Rudiak-Gould.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5978 cda61777-01e9-0310-a592-d414129be87e

pscp.c
ssh.c

diff --git a/pscp.c b/pscp.c
index 9259dd0..c0bcc60 100644 (file)
--- a/pscp.c
+++ b/pscp.c
@@ -213,8 +213,6 @@ int from_backend(void *frontend, int is_stderr, const char *data, int datalen)
        if (pendsize < pendlen + len) {
            pendsize = pendlen + len + 4096;
            pending = sresize(pending, pendsize, unsigned char);
-           if (!pending)
-               fatalbox("Out of memory");
        }
        memcpy(pending + pendlen, p, len);
        pendlen += len;
diff --git a/ssh.c b/ssh.c
index 1e675d2..66b316e 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -1652,8 +1652,6 @@ static unsigned char *ssh2_mpint_fmt(Bignum b, int *len)
     unsigned char *p;
     int i, n = (bignum_bitcount(b) + 7) / 8;
     p = snewn(n + 1, unsigned char);
-    if (!p)
-       fatalbox("out of memory");
     p[0] = 0;
     for (i = 1; i <= n; i++)
        p[i] = bignum_byte(b, n - i);
@@ -2657,8 +2655,6 @@ static const char *connect_to_host(Ssh ssh, char *host, int port,
     const char *err;
 
     ssh->savedhost = snewn(1 + strlen(host), char);
-    if (!ssh->savedhost)
-       fatalbox("Out of memory");
     strcpy(ssh->savedhost, host);
 
     if (port < 0)
@@ -3011,8 +3007,6 @@ static int do_ssh1_login(Ssh ssh, unsigned char *in, int inlen,
     s->len = (hostkey.bytes > servkey.bytes ? hostkey.bytes : servkey.bytes);
 
     s->rsabuf = snewn(s->len, unsigned char);
-    if (!s->rsabuf)
-       fatalbox("Out of memory");
 
     /*
      * Verify the host key.
@@ -3024,8 +3018,6 @@ static int do_ssh1_login(Ssh ssh, unsigned char *in, int inlen,
        int len = rsastr_len(&hostkey);
        char fingerprint[100];
        char *keystr = snewn(len, char);
-       if (!keystr)
-           fatalbox("Out of memory");
        rsastr_fmt(keystr, &hostkey);
        rsa_fingerprint(fingerprint, sizeof(fingerprint), &hostkey);