Skip to content

Commit 5e6109e

Browse files
committed
log BUGFIX memory leak
1 parent 6491de0 commit 5e6109e

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/log.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,6 @@ ly_vlog_build_path_reverse(enum LY_VLOG_ELEM elem_type, const void *elem, char *
551551
}
552552
} else {
553553
/* schema list without keys - use instance position */
554-
555554
i = j = lyd_list_pos(dlist);
556555
len = 1;
557556
while (j > 9) {
@@ -563,7 +562,7 @@ ly_vlog_build_path_reverse(enum LY_VLOG_ELEM elem_type, const void *elem, char *
563562
LY_CHECK_ERR_RETURN(!str, LOGMEM, );
564563
sprintf(str, "%d", i);
565564

566-
LY_CHECK_ERR_RETURN((*index) < len + 2, LOGERR(LY_SUCCESS, "%s: path is too long."),);
565+
LY_CHECK_ERR_RETURN((*index) < len + 2, free(str); LOGERR(LY_SUCCESS, "%s: path is too long."),);
567566
path[--(*index)] = ']';
568567
(*index) -= len;
569568
strncpy(&path[(*index)], str, len);

0 commit comments

Comments
 (0)