vty: Fix a memory leak in the vty description command
authorHolger Hans Peter Freyther <zecke@selfish.org>
Thu, 24 Feb 2011 13:20:41 +0000 (14:20 +0100)
committerHolger Hans Peter Freyther <zecke@selfish.org>
Tue, 29 Mar 2011 11:24:21 +0000 (13:24 +0200)
Before assigning a new string, free the previous one. This
assume that it was allocated with talloc which should be true
for the osmocom users.

src/vty/logging_vty.c

index 4cab22a..b037a5b 100644 (file)
@@ -269,6 +269,8 @@ gDEFUN(cfg_description, cfg_description_cmd,
                return CMD_WARNING;
        }
 
+       if (*dptr)
+               talloc_free(*dptr);
        *dptr = argv_concat(argv, argc, 0);
        if (!dptr)
                return CMD_WARNING;