Commit a7d3a7a0 authored by Michael Tremer's avatar Michael Tremer

as: Fix dereferencing NULL pointer when setting AS name

Reported-by: default avatarGisle Vanem <gisle.vanem@gmail.com>
Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 44341478
......@@ -90,7 +90,13 @@ LOC_EXPORT const char* loc_as_get_name(struct loc_as* as) {
}
LOC_EXPORT int loc_as_set_name(struct loc_as* as, const char* name) {
as->name = strdup(name);
if (as->name)
free(as->name);
if (name)
as->name = strdup(name);
else
as->name = NULL;
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment