Commit 48730a9
i2c: dev: Fix memory leak when underlying adapter does not support I2C
Early return in i2cdev_ioctl_rdwr() failed to free the memory allocated
by the caller. Move freeing the memory to the function where it has been
allocated to prevent similar leaks in the future.
Fixes: 97ca843 ("i2c: dev: Check for I2C_FUNC_I2C before calling i2c_transfer")
Signed-off-by: Igor Pylypiv <[email protected]>
[wsa: replaced '== NULL' with '!']
Signed-off-by: Wolfram Sang <[email protected]>1 parent 433c691 commit 48730a9
1 file changed
+9
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
255 | | - | |
| 254 | + | |
256 | 255 | | |
257 | | - | |
258 | 256 | | |
259 | 257 | | |
260 | 258 | | |
| |||
302 | 300 | | |
303 | 301 | | |
304 | 302 | | |
305 | | - | |
306 | 303 | | |
307 | 304 | | |
308 | 305 | | |
| |||
316 | 313 | | |
317 | 314 | | |
318 | 315 | | |
319 | | - | |
320 | 316 | | |
321 | 317 | | |
322 | 318 | | |
| |||
446 | 442 | | |
447 | 443 | | |
448 | 444 | | |
| 445 | + | |
449 | 446 | | |
450 | 447 | | |
451 | 448 | | |
| |||
467 | 464 | | |
468 | 465 | | |
469 | 466 | | |
470 | | - | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
471 | 470 | | |
472 | 471 | | |
473 | 472 | | |
| |||
540 | 539 | | |
541 | 540 | | |
542 | 541 | | |
543 | | - | |
| 542 | + | |
544 | 543 | | |
545 | 544 | | |
546 | 545 | | |
| |||
573 | 572 | | |
574 | 573 | | |
575 | 574 | | |
576 | | - | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
577 | 578 | | |
578 | 579 | | |
579 | 580 | | |
| |||
0 commit comments