diff --git a/lib/src/clixon_yang_parse_lib.c b/lib/src/clixon_yang_parse_lib.c index abc8c8f8..640f7c32 100644 --- a/lib/src/clixon_yang_parse_lib.c +++ b/lib/src/clixon_yang_parse_lib.c @@ -1298,8 +1298,11 @@ yang_spec_load_dir(clicon_handle h, char *nextbase = NULL; /* XXX suboptimal algorithm, could combione old/next/base */ if (filename2revision(dp[i+1].d_name, &nextbase, NULL) < 0) goto done; - if (nextbase && strcmp(base, nextbase) == 0) + if (nextbase && strcmp(base, nextbase) == 0){ + free(nextbase); + nextbase = NULL; continue; /* same base: skip; */ + } if (nextbase) free(nextbase); }