diff options
author | Jesper Juhl <jesper.juhl@gmail.com> | 2007-08-10 18:23:54 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-08-14 01:52:10 -0400 |
commit | e576de82ee628f68e5a44527c7ee99eadeab2e62 (patch) | |
tree | 387900c511a4171568997f37e450238107746b6d /net/dccp | |
parent | d725fdc8027a4cd961f58d92917fbb91b171abfa (diff) |
[DCCP]: fix memory leak and clean up style - dccp_feat_empty_confirm()
There's a memory leak in net/dccp/feat.c::dccp_feat_empty_confirm(). If we
hit the 'default:' case of the 'switch' statement, then we return without
freeing 'opt', thus leaking 'struct dccp_opt_pend' bytes.
The leak is fixed easily enough by adding a kfree(opt); before the return
statement.
The patch also changes the layout of the 'switch' to be more in line with
CodingStyle.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/feat.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/net/dccp/feat.c b/net/dccp/feat.c index cd845df5320d..5ebdd86c1b99 100644 --- a/net/dccp/feat.c +++ b/net/dccp/feat.c | |||
@@ -327,10 +327,16 @@ static void dccp_feat_empty_confirm(struct dccp_minisock *dmsk, | |||
327 | } | 327 | } |
328 | 328 | ||
329 | switch (type) { | 329 | switch (type) { |
330 | case DCCPO_CHANGE_L: opt->dccpop_type = DCCPO_CONFIRM_R; break; | 330 | case DCCPO_CHANGE_L: |
331 | case DCCPO_CHANGE_R: opt->dccpop_type = DCCPO_CONFIRM_L; break; | 331 | opt->dccpop_type = DCCPO_CONFIRM_R; |
332 | default: DCCP_WARN("invalid type %d\n", type); return; | 332 | break; |
333 | 333 | case DCCPO_CHANGE_R: | |
334 | opt->dccpop_type = DCCPO_CONFIRM_L; | ||
335 | break; | ||
336 | default: | ||
337 | DCCP_WARN("invalid type %d\n", type); | ||
338 | kfree(opt); | ||
339 | return; | ||
334 | } | 340 | } |
335 | opt->dccpop_feat = feature; | 341 | opt->dccpop_feat = feature; |
336 | opt->dccpop_val = NULL; | 342 | opt->dccpop_val = NULL; |