diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2012-06-08 20:56:22 +0200 | 
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2012-06-08 20:57:11 +0200 | 
| commit | e3f5e04cf09b59a70866c0a08d5310e57492cf73 (patch) | |
| tree | cf3cb11d66e031480a1ff8f76d52cda92d4724ba | |
| parent | 0cd8c287a46420768a5b11406638316f859a4873 (diff) | |
openldap: OOM fixes
when calloc fails, return error! (Detected by Fortify)
Reported by: Robert B. Harris
| -rw-r--r-- | lib/openldap.c | 4 | 
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/openldap.c b/lib/openldap.c index 3886d0889..9ccfa7fae 100644 --- a/lib/openldap.c +++ b/lib/openldap.c @@ -171,6 +171,8 @@ static CURLcode ldap_setup(struct connectdata *conn)    ldap_free_urldesc(lud);    li = calloc(1, sizeof(ldapconninfo)); +  if(!li) +    return CURLE_OUT_OF_MEMORY;    li->proto = proto;    conn->proto.generic = li;    conn->bits.close = FALSE; @@ -386,6 +388,8 @@ static CURLcode ldap_do(struct connectdata *conn, bool *done)      return CURLE_LDAP_SEARCH_FAILED;    }    lr = calloc(1,sizeof(ldapreqinfo)); +  if(!lr) +    return CURLE_OUT_OF_MEMORY;    lr->msgid = msgid;    data->state.proto.generic = lr;    Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, NULL, -1, NULL);  | 
