Browse Source

env: avoid leaving dangling pointers in __env_map

This is the minimal fix for __putenv leaving a pointer to freed heap
storage in __env_map array, which could later on lead to errors such
as double-free.
Alexander Monakov 9 years ago
parent
commit
9543656cc3
1 changed files with 1 additions and 0 deletions
  1. 1 0
      src/env/putenv.c

+ 1 - 0
src/env/putenv.c

@@ -30,6 +30,7 @@ int __putenv(char *s, int a)
 				}
 			} else {
 				free(__env_map[j]);
+				__env_map[j] = s;
 			}
 		}
 	}