diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-04-16 21:36:12 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-04-17 19:58:24 +0200 |
commit | 0e9f8d2d8637b86889fc82ecca60d1b23bdfccfd (patch) | |
tree | 81feae4bf08762915f7da2f5acb7714bd69ba5e5 /tests/ospf6d | |
parent | bgpd: fix stylistic issue (diff) | |
download | frr-0e9f8d2d8637b86889fc82ecca60d1b23bdfccfd.tar.xz frr-0e9f8d2d8637b86889fc82ecca60d1b23bdfccfd.zip |
ospf6d: handle realloc() failure in lsa test
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'tests/ospf6d')
-rw-r--r-- | tests/ospf6d/test_lsdb.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/ospf6d/test_lsdb.c b/tests/ospf6d/test_lsdb.c index 633e88e76..ec0835c71 100644 --- a/tests/ospf6d/test_lsdb.c +++ b/tests/ospf6d/test_lsdb.c @@ -38,9 +38,15 @@ static size_t lsa_count = 0; static void lsa_check_resize(size_t len) { + struct ospf6_lsa **templsas; + if (lsa_count >= len) return; - lsas = realloc(lsas, len * sizeof(lsas[0])); + templsas = realloc(lsas, len * sizeof(lsas[0])); + if (templsas) + lsas = templsas; + else + return; memset(lsas + lsa_count, 0, sizeof(lsas[0]) * (len - lsa_count)); lsa_count = len; |