btrfs-progs: string-table: fix memory leak on exit path in table_vprintf()
Reported by 'gcc -fanalyzer: common/string-table.c:62:17: warning: leak of ‘msg’ [CWE-401] [-Wanalyzer-malloc-leak] The 'msg' still allocated when returning from the function due to error, free it. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
27198a4c26
commit
9c156ab9ca
|
@ -57,6 +57,7 @@ char *table_vprintf(struct string_table *tab, unsigned int column, unsigned int
|
|||
return NULL;
|
||||
|
||||
if (column >= tab->ncols || row >= tab->nrows) {
|
||||
free(msg);
|
||||
error("attempt to write outside of table: col %u row %u fmt %s",
|
||||
column, row, fmt);
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in New Issue