diff options
-rw-r--r-- | net/tipc/name_table.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index d129422fc5c2..051143648edb 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c | |||
@@ -284,18 +284,18 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, | |||
284 | /* Ensure there is space for new sub-sequence */ | 284 | /* Ensure there is space for new sub-sequence */ |
285 | 285 | ||
286 | if (nseq->first_free == nseq->alloc) { | 286 | if (nseq->first_free == nseq->alloc) { |
287 | struct sub_seq *sseqs = nseq->sseqs; | 287 | struct sub_seq *sseqs = tipc_subseq_alloc(nseq->alloc * 2); |
288 | nseq->sseqs = tipc_subseq_alloc(nseq->alloc * 2); | 288 | |
289 | if (nseq->sseqs != NULL) { | 289 | if (!sseqs) { |
290 | memcpy(nseq->sseqs, sseqs, | ||
291 | nseq->alloc * sizeof (struct sub_seq)); | ||
292 | kfree(sseqs); | ||
293 | dbg("Allocated %u sseqs\n", nseq->alloc); | ||
294 | nseq->alloc *= 2; | ||
295 | } else { | ||
296 | warn("Memory squeeze; failed to create sub-sequence\n"); | 290 | warn("Memory squeeze; failed to create sub-sequence\n"); |
297 | return NULL; | 291 | return NULL; |
298 | } | 292 | } |
293 | dbg("Allocated %u more sseqs\n", nseq->alloc); | ||
294 | memcpy(sseqs, nseq->sseqs, | ||
295 | nseq->alloc * sizeof(struct sub_seq)); | ||
296 | kfree(nseq->sseqs); | ||
297 | nseq->sseqs = sseqs; | ||
298 | nseq->alloc *= 2; | ||
299 | } | 299 | } |
300 | dbg("Have %u sseqs for type %u\n", nseq->alloc, type); | 300 | dbg("Have %u sseqs for type %u\n", nseq->alloc, type); |
301 | 301 | ||