From 3e0668d63ab553f1edb74404dad210bc660cbfa4 Mon Sep 17 00:00:00 2001 From: Christian Spielberger Date: Wed, 4 Oct 2023 07:11:28 +0200 Subject: [PATCH] jbuf: better err handling for jbuf_resize() --- src/jbuf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/jbuf.c b/src/jbuf.c index a0d6185403..95a49e66ca 100644 --- a/src/jbuf.c +++ b/src/jbuf.c @@ -303,9 +303,12 @@ int jbuf_alloc(struct jbuf **jbp, uint32_t min, uint32_t max) */ int jbuf_resize(struct jbuf *jb, uint32_t packets) { - if (packets <= jb->packets) + if (!jb) return EINVAL; + if (packets <= jb->packets) + return 0; + for (uint32_t i=jb->packets; i