From b75926f1634af2bce6da74555afe6365ad09a99a Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Feb 2026 10:20:37 -0800 Subject: [PATCH] fix: add missing return statements in doubly_linked_list.c Three functions had missing return statements causing undefined behavior: 1. search(): The recursive call result was not returned, so search only worked for the head node. 2. insert(): No return when pos <= 0, falling off the end of a non-void function. 3. delete(): Same issue as insert() for pos <= 0. Fixes #1554 --- data_structures/linked_list/doubly_linked_list.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/data_structures/linked_list/doubly_linked_list.c b/data_structures/linked_list/doubly_linked_list.c index 8a3d9c48a6..2d8d665f3d 100644 --- a/data_structures/linked_list/doubly_linked_list.c +++ b/data_structures/linked_list/doubly_linked_list.c @@ -168,6 +168,8 @@ List *insert(List *list, double value, int pos) } return list; } + + return list; } /** @@ -230,6 +232,8 @@ List *delete(List *list, int pos) } return list; } + + return list; } /** @@ -245,7 +249,7 @@ int search(List *list, double value) return 0; if (list->value == value) return 1; - search(list->next, value); + return search(list->next, value); } /**