Commit 52cf0a1
Fix possible double free in cli_command_name
Coverity indicates a possible double free in cli_command_name. This
appears to be due to name being set to cli->commandname, and then if
this is not null name is freed, but cli->commandname is untouched. If
this routine exits early (for example, the calloc fails), then
cli->commandname is now pointing to a freed memory block.
Fixed by ensuring that cli->commandname is freed and set to null if
not null already before assigning cli->commandname to name.1 parent 51f018c commit 52cf0a1
1 file changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
166 | 167 | | |
167 | 168 | | |
168 | | - | |
| 169 | + | |
169 | 170 | | |
170 | 171 | | |
171 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
172 | 179 | | |
173 | 180 | | |
174 | 181 | | |
| |||
0 commit comments