[FIX] WSP: double free
authorAlexander Aksenov <a.aksenov@samsung.com>
Fri, 30 Oct 2015 09:05:07 +0000 (12:05 +0300)
committerAlexander Aksenov <a.aksenov@samsung.com>
Fri, 30 Oct 2015 09:40:26 +0000 (12:40 +0300)
Issue:
Freeing pointer to the memory that was already freed.

Solution:
Set pointer to NULL after free. kfree(NULL) is safe according
to standart.

Change-Id: I5fd0ceee1078a71d17a44aacb1319b116f5d5c9d
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
wsp/wsp.c

index 85b8bdf..ac59030 100644 (file)
--- a/wsp/wsp.c
+++ b/wsp/wsp.c
@@ -383,6 +383,7 @@ static void do_set_path(char **dest, char *path, size_t len)
 static void do_free_path(char **dest)
 {
        kfree(*dest);
+       *dest = NULL;
 }