isdn/gigaset: add a kfree() to error path
Subsystems (3)
PATCH 1/1 isdn/gigaset: add a kfree() to error path
We should free "commands" here. The main reason is to please the static checkers.
drivers/isdn/gigaset/i4l.c +1 -0
@@ -419,6 +419,7 @@ oom:dev_err (bcs->cs->dev,"out of memory\n" );for (i =0 ; i <AT_NUM ; ++i)kfree (commands[i]); +kfree (commands);return -ENOMEM ; }
Dan,
thanks for your patch. It is quite correct as it stands. There is however another problem with that error path, in that it also doesn't free the previously allocated channel. I prefer not to carry two separate patches for that, so I'm replacing your patch with the following augmented patch, which I'll submit together with my other pending patches for 2.6.36 soon:
Subject: [PATCH] isdn/gigaset: fix leaks in error path
Take care to free all previously allocated ressources in the "out of memory" error path of the ISDN_CMD_DIAL branch. Based on an original patch by Dan Carpenter.
Impact: bugfix
--- drivers/isdn/gigaset/i4l.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/isdn/gigaset/i4l.c +2 -0
@@ -419,6 +419,8 @@ oom:dev_err (bcs->cs->dev,"out of memory\n" );for (i =0 ; i <AT_NUM ; ++i)kfree (commands[i]); +kfree (commands); +gigaset_free_channel (bcs);return -ENOMEM ; }
Signature · 7 lines
1.6.5.3.298.g39add -- Tilman Schmidt E-Mail: [email protected] Bonn, Germany Diese Nachricht besteht zu 100% aus wiederverwerteten Bits. Ungeöffnet mindestens haltbar bis: (siehe Rückseite)
Dan Carpenter
Acked-byQuoted 10 lines · Tilman Schmidt
Dan,
thanks for your patch. It is quite correct as it stands. There is however another problem with that error path, in that it also doesn't free the previously allocated channel. I prefer not to carry two separate patches for that, so I'm replacing your patch with the following augmented patch, which I'll submit together with my other pending patches for 2.6.36 soon:
Good deal.
regards,
dan carpenter