]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
xfrm: fix an unintialized return value on memory allocation error in xfrmnl_ae_parse()
authorNicolas PLANEL <nicolas.planel@enovance.com>
Tue, 26 Aug 2014 15:31:15 +0000 (11:31 -0400)
committerThomas Haller <thaller@redhat.com>
Wed, 27 Aug 2014 10:59:39 +0000 (12:59 +0200)
fix : err = -ENOMEM if calloc() failed

Signed-off-by: Thomas Haller <thaller@redhat.com>
lib/xfrm/ae.c

index a4db3002eca6f078ce2dd3b051900cbf5f3d2ce6..4fe964725b5250bed47265782d388e5b003e6e80 100644 (file)
@@ -533,8 +533,10 @@ int xfrmnl_ae_parse(struct nlmsghdr *n, struct xfrmnl_ae **result)
                struct xfrm_replay_state_esn* esn =  nla_data (tb[XFRMA_REPLAY_ESN_VAL]);
                uint32_t len = sizeof (struct xfrmnl_replay_state_esn) +  (sizeof (uint32_t) * esn->bmp_len);
 
-               if ((ae->replay_state_esn = calloc (1, len)) == NULL)
+               if ((ae->replay_state_esn = calloc (1, len)) == NULL) {
+                       err = -ENOMEM;
                        goto errout;
+               }
                ae->replay_state_esn->oseq       =  esn->oseq;
                ae->replay_state_esn->seq        =  esn->seq;
                ae->replay_state_esn->oseq_hi    =  esn->oseq_hi;