Skip to content

Commit

Permalink
codegen: fix memleak
Browse files Browse the repository at this point in the history
  • Loading branch information
kodebach committed Mar 29, 2019
1 parent bef60e3 commit f22f68d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/tools/kdb/gen/elektragen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "elektragen.hpp"

#include <command.hpp>
#include <kdbhelper.h>
#include <kdbtypes.h>
#include <modules.hpp>

Expand Down Expand Up @@ -394,10 +395,10 @@ static void processStructRef (const kdb::Key & key, const kdb::Key & parentKey,
}

auto restrict = key.getMeta<std::string> ("check/reference/restrict");
restrict = ckdb::elektraResolveReference (restrict.c_str (), key.getKey (), parentKey.getKey ());
char * rawResolved = ckdb::elektraResolveReference (restrict.c_str (), key.getKey (), parentKey.getKey ());

auto restrictKey = allKeys.lookup (restrict);
elektraFree (restrict);
auto restrictKey = allKeys.lookup (rawResolved);
ckdb::elektraFree (rawResolved);

if (!restrictKey)
{
Expand Down

0 comments on commit f22f68d

Please sign in to comment.