mirror of
https://github.com/profanity-im/profanity.git
synced 2024-09-08 19:34:14 -04:00
Used strdup in prof_autocomplete
This commit is contained in:
parent
6abbe62710
commit
87c3107847
@ -195,18 +195,13 @@ _search_from(PAutocomplete ac, GSList *curr)
|
|||||||
while(curr) {
|
while(curr) {
|
||||||
|
|
||||||
// match found
|
// match found
|
||||||
if (strncmp(curr->data,
|
if (strncmp(curr->data, ac->search_str, strlen(ac->search_str)) == 0) {
|
||||||
ac->search_str,
|
|
||||||
strlen(ac->search_str)) == 0) {
|
|
||||||
gchar *result =
|
|
||||||
(gchar *) malloc((strlen(curr->data) + 1) * sizeof(gchar));
|
|
||||||
|
|
||||||
// set pointer to last found
|
// set pointer to last found
|
||||||
ac->last_found = curr;
|
ac->last_found = curr;
|
||||||
|
|
||||||
// return the string, must be free'd by caller
|
// return the string, must be free'd by caller
|
||||||
strcpy(result, curr->data);
|
return strdup(curr->data);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
curr = g_slist_next(curr);
|
curr = g_slist_next(curr);
|
||||||
|
Loading…
Reference in New Issue
Block a user