use correct pointer and do not access destroyed memory default tip
authorWolfgang Rosenauer <wr@rosenauer.org>
Thu, 08 Dec 2011 22:33:48 +0100
changeset 4 69b7ac3efaa2
parent 3 1d5c74914855
use correct pointer and do not access destroyed memory
nss-shared-helper/db.c
--- a/nss-shared-helper/db.c	Thu Dec 08 22:17:21 2011 +0100
+++ b/nss-shared-helper/db.c	Thu Dec 08 22:33:48 2011 +0100
@@ -55,11 +55,12 @@
 {
   const char  *env;
   char        *path;
-  char         system_path[] = DEFAULT_PATH;
+  char        *system_path;
   struct stat  sbuf;
   int          result;
 
   env = getenv ("NSS_SHARED_DB_PATH");
+  system_path = strdup(DEFAULT_PATH);
 
   /*
    * 1. use env NSS_SHARED_DB_PATH
@@ -120,6 +121,7 @@
     return path;
 
   free (path);
+  free (system_path);
   return NULL;
 }