File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -1675,13 +1675,20 @@ lyd_lyb_data_length(const char *data)
16751675 LY_ERR ret = LY_SUCCESS ;
16761676 struct lylyb_ctx * lybctx ;
16771677 uint32_t count ;
1678+ uint8_t * buf ;
16781679 uint8_t zero [LYB_SIZE_BYTES ] = {0 };
16791680
16801681 if (!data ) {
16811682 return -1 ;
16821683 }
16831684
1685+ buf = calloc (1 , LYB_SIZE_MAX );
1686+ LY_CHECK_ERR_RET (!buf , LOGMEM (NULL ), LY_EMEM );
1687+
16841688 lybctx = calloc (1 , sizeof * lybctx );
1689+ if (!lybctx ) {
1690+ free (buf );
1691+ }
16851692 LY_CHECK_ERR_RET (!lybctx , LOGMEM (NULL ), LY_EMEM );
16861693 ret = ly_in_new_memory (data , & lybctx -> in );
16871694 LY_CHECK_GOTO (ret , cleanup );
@@ -1717,6 +1724,7 @@ lyd_lyb_data_length(const char *data)
17171724
17181725 ly_in_free (lybctx -> in , 0 );
17191726 lylyb_ctx_free (lybctx );
1727+ free (buf );
17201728
17211729 return ret ? -1 : (int )count ;
17221730}
You can’t perform that action at this time.
0 commit comments