data_structures

data structures in C
Log | Files | Refs | Feed

commit 9934e2c3ee88670ece5520b8d61ed2977e17c99a
parent f107c552c0ecf0eaca0f9b1b5d4e90b5d4097530
Author: Jenny Doe <tng@soykaf.me>
Date:   Thu, 21 Mar 2019 22:44:01 +0100

fixed: obvious mem leak

Diffstat:
Mdlist.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/dlist.c b/dlist.c @@ -111,13 +111,12 @@ int dlist_remove(dList * list, dListElmt * old, void **data) { - if (list->size == 0) + if (list->size == 0 || old == NULL) return (1); - if (old == NULL) + if (list->size == 1) { old = list->head; - if (list->size == 1) { list->head = NULL; list->tail = NULL; } else {