Skip to content

Commit 44ef3a0

Browse files
wenwenwang1davem330
authored andcommitted
wimax/i2400m: fix a memory leak bug
In i2400m_barker_db_init(), 'options_orig' is allocated through kstrdup() to hold the original command line options. Then, the options are parsed. However, if an error occurs during the parsing process, 'options_orig' is not deallocated, leading to a memory leak bug. To fix this issue, free 'options_orig' before returning the error. Signed-off-by: Wenwen Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3434341 commit 44ef3a0

File tree

1 file changed

+3
-1
lines changed
  • drivers/net/wimax/i2400m

1 file changed

+3
-1
lines changed

drivers/net/wimax/i2400m/fw.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,15 @@ int i2400m_barker_db_init(const char *_options)
351351
}
352352
result = i2400m_barker_db_add(barker);
353353
if (result < 0)
354-
goto error_add;
354+
goto error_parse_add;
355355
}
356356
kfree(options_orig);
357357
}
358358
return 0;
359359

360+
error_parse_add:
360361
error_parse:
362+
kfree(options_orig);
361363
error_add:
362364
kfree(i2400m_barker_db);
363365
return result;

0 commit comments

Comments
 (0)