mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Fix potential memleak in stanza_create_caps_from_query_element()
Each of those should only occur one time. But let's make sure we only write/alloc one time to be on the safe side.
This commit is contained in:
parent
95b75a2948
commit
9e460973fa
@ -1784,13 +1784,21 @@ stanza_create_caps_from_query_element(xmpp_stanza_t *query)
|
|||||||
formField = field->data;
|
formField = field->data;
|
||||||
if (formField->values) {
|
if (formField->values) {
|
||||||
if (strcmp(formField->var, "software") == 0) {
|
if (strcmp(formField->var, "software") == 0) {
|
||||||
software = strdup(formField->values->data);
|
if (software == NULL) {
|
||||||
|
software = strdup(formField->values->data);
|
||||||
|
}
|
||||||
} else if (strcmp(formField->var, "software_version") == 0) {
|
} else if (strcmp(formField->var, "software_version") == 0) {
|
||||||
software_version = strdup(formField->values->data);
|
if (software_version == NULL) {
|
||||||
|
software_version = strdup(formField->values->data);
|
||||||
|
}
|
||||||
} else if (strcmp(formField->var, "os") == 0) {
|
} else if (strcmp(formField->var, "os") == 0) {
|
||||||
os = strdup(formField->values->data);
|
if (os == NULL) {
|
||||||
|
os = strdup(formField->values->data);
|
||||||
|
}
|
||||||
} else if (strcmp(formField->var, "os_version") == 0) {
|
} else if (strcmp(formField->var, "os_version") == 0) {
|
||||||
os_version = strdup(formField->values->data);
|
if (os_version == NULL) {
|
||||||
|
os_version = strdup(formField->values->data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
field = g_slist_next(field);
|
field = g_slist_next(field);
|
||||||
|
Loading…
Reference in New Issue
Block a user