瀏覽代碼

Fixed memory leak. Fixes #3.

woollybah 10 年之前
父節點
當前提交
17db4e5e71
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      stdc.mod/stdc.c

+ 3 - 1
stdc.mod/stdc.c

@@ -217,7 +217,9 @@ int putenv_( BBString *str ){
 	char *t=bbTmpUTF8String( str );
 	char *t=bbTmpUTF8String( str );
 	char *p=(char*)malloc( strlen(t)+1 );
 	char *p=(char*)malloc( strlen(t)+1 );
 	strcpy( p,t );
 	strcpy( p,t );
-	return putenv( p );
+	int res = putenv( p );
+	free(p);
+	return res;
 }
 }
 
 
 BBString *getenv_( BBString *str ){
 BBString *getenv_( BBString *str ){