mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-15 21:44:36 +03:00
Use strdup explicitly
This commit is contained in:
@ -54,8 +54,8 @@ FunctionBar* FunctionBar_new(const char** functions, const char** keys, int* eve
|
||||
this->events = malloc(sizeof(int) * 15);
|
||||
int i = 0;
|
||||
while (i < 15 && functions[i]) {
|
||||
this->functions[i] = String_copy(functions[i]);
|
||||
this->keys[i] = String_copy(keys[i]);
|
||||
this->functions[i] = strdup(functions[i]);
|
||||
this->keys[i] = strdup(keys[i]);
|
||||
this->events[i] = events[i];
|
||||
i++;
|
||||
}
|
||||
@ -89,7 +89,7 @@ void FunctionBar_setLabel(FunctionBar* this, int event, const char* text) {
|
||||
for (int i = 0; i < this->size; i++) {
|
||||
if (this->events[i] == event) {
|
||||
free(this->functions[i]);
|
||||
this->functions[i] = String_copy(text);
|
||||
this->functions[i] = strdup(text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user