Commit e7c8bf0
cachedb_cassandra: fix NULL deref when cass_cluster_new() returns NULL
cass_cluster_new() can return NULL on allocation failure. The existing code
has a NULL check, but it comes after cass_cluster_set_credentials() already
uses the pointer (when credentials are configured), so a NULL return causes
a crash before the check is reached.
Move the NULL check to immediately after cass_cluster_new(), before any use
of the returned pointer.
Found during a systematic audit of cachedb backends following the
cachedb_redis NULL-deref fix in commit 8fb569c.
(cherry picked from commit 8f959e7)1 parent b747385 commit e7c8bf0
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | 144 | | |
148 | 145 | | |
149 | 146 | | |
150 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
0 commit comments