mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 02:24:24 +02:00
perf session: Don't write to memory pointed to a const pointer
Since it is freshly allocated just attribute it to a non-const pointer and then change it via that pointer. That way we avoid const-correctness warnings in recent glibc versions. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
678ed6b707
commit
f1321cce84
|
|
@ -2676,7 +2676,7 @@ bool perf_session__has_switch_events(struct perf_session *session)
|
|||
|
||||
int map__set_kallsyms_ref_reloc_sym(struct map *map, const char *symbol_name, u64 addr)
|
||||
{
|
||||
char *bracket;
|
||||
char *bracket, *name;
|
||||
struct ref_reloc_sym *ref;
|
||||
struct kmap *kmap;
|
||||
|
||||
|
|
@ -2684,13 +2684,13 @@ int map__set_kallsyms_ref_reloc_sym(struct map *map, const char *symbol_name, u6
|
|||
if (ref == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
ref->name = strdup(symbol_name);
|
||||
ref->name = name = strdup(symbol_name);
|
||||
if (ref->name == NULL) {
|
||||
free(ref);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
bracket = strchr(ref->name, ']');
|
||||
bracket = strchr(name, ']');
|
||||
if (bracket)
|
||||
*bracket = '\0';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user