mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 23:26:21 +00:00
Used strdup in prof_autocomplete
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user