libcamera: base: log: Fix use of freed name
LogCategory just stores the char * that was given to it in the constructor, i.e. it refers to memory "outside" LogCategory. If the LogCategory is defined in a .so that is unloaded, then it leads to the LogCategory pointing to freed memory, causing a crash. Fix this by taking a copy of the name by using a std::string instead of just storing the pointer. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
committed by
Laurent Pinchart
parent
376adeb7b7
commit
662df4ca26
@@ -568,7 +568,7 @@ void Logger::logSetLevel(const char *category, const char *level)
|
||||
return;
|
||||
|
||||
for (LogCategory *c : categories_) {
|
||||
if (!strcmp(c->name(), category)) {
|
||||
if (c->name() == category) {
|
||||
c->setSeverity(severity);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user