Thread (8 messages) flat view 8 messages, 2 authors, 2016-06-15
STALE3731d

[PATCH v2 1/4] streaming: allow to call close_istream(NULL);

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 22:53:50
Subsystem: the rest · Maintainer: Linus Torvalds

This makes it more convenient in cleanup code, like free(NULL).

Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 streaming.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/streaming.c b/streaming.c
index 3a3cd12..38b39cd 100644
--- a/streaming.c
+++ b/streaming.c
@@ -94,7 +94,7 @@ struct git_istream {
 
 int close_istream(struct git_istream *st)
 {
-	int r = st->vtbl->close(st);
+	int r = st ? st->vtbl->close(st) : 0;
 	free(st);
 	return r;
 }
-- 
1.7.8.36.g69ee2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help