aboutsummaryrefslogtreecommitdiff
path: root/lib/http2.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/http2.c')
-rw-r--r--lib/http2.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/lib/http2.c b/lib/http2.c
index e123bc56c..f8e23c517 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -2137,35 +2137,37 @@ CURLcode Curl_http2_switched(struct connectdata *conn,
void Curl_http2_add_child(struct Curl_easy *parent, struct Curl_easy *child,
bool exclusive)
{
- struct Curl_http2_dep **tail;
- struct Curl_http2_dep *dep = calloc(1, sizeof(struct Curl_http2_dep));
- dep->data = child;
-
- if(parent->set.stream_dependents && exclusive) {
- struct Curl_http2_dep *node = parent->set.stream_dependents;
- while(node) {
- node->data->set.stream_depends_on = child;
- node = node->next;
+ if(parent) {
+ struct Curl_http2_dep **tail;
+ struct Curl_http2_dep *dep = calloc(1, sizeof(struct Curl_http2_dep));
+ dep->data = child;
+
+ if(parent->set.stream_dependents && exclusive) {
+ struct Curl_http2_dep *node = parent->set.stream_dependents;
+ while(node) {
+ node->data->set.stream_depends_on = child;
+ node = node->next;
+ }
+
+ tail = &child->set.stream_dependents;
+ while(*tail)
+ tail = &(*tail)->next;
+
+ DEBUGASSERT(!*tail);
+ *tail = parent->set.stream_dependents;
+ parent->set.stream_dependents = 0;
}
- tail = &child->set.stream_dependents;
- while(*tail)
+ tail = &parent->set.stream_dependents;
+ while(*tail) {
+ (*tail)->data->set.stream_depends_e = FALSE;
tail = &(*tail)->next;
+ }
DEBUGASSERT(!*tail);
- *tail = parent->set.stream_dependents;
- parent->set.stream_dependents = 0;
+ *tail = dep;
}
- tail = &parent->set.stream_dependents;
- while(*tail) {
- (*tail)->data->set.stream_depends_e = FALSE;
- tail = &(*tail)->next;
- }
-
- DEBUGASSERT(!*tail);
- *tail = dep;
-
child->set.stream_depends_on = parent;
child->set.stream_depends_e = exclusive;
}