소스 검색

backport:
- *_realloc bug fix: on grow, when out of memory, realloc would free the
original pointer (instead of leaving it alone and just returning null)$

Andrei Pelinescu-Onciul 19 년 전
부모
커밋
5cf136c776
4개의 변경된 파일15개의 추가작업 그리고 5개의 파일을 삭제
  1. 2 2
      Makefile.defs
  2. 6 0
      debian/changelog
  3. 4 2
      mem/f_malloc.c
  4. 3 1
      mem/q_malloc.c

+ 2 - 2
Makefile.defs

@@ -58,8 +58,8 @@ MAIN_NAME=ser
 #version number
 VERSION = 0
 PATCHLEVEL = 9
-SUBLEVEL = 6
-EXTRAVERSION = 
+SUBLEVEL = 7
+EXTRAVERSION = -pre1
 
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")

+ 6 - 0
debian/changelog

@@ -1,3 +1,9 @@
+ser (0.9.6-0.1) unstable; urgency=low
+
+  * new upstream release (bug fixes) 
+
+ -- Andrei Pelinescu-Onciul <[email protected]>  Mon, 16 Jan 2006 20:02:52 +0200
+
 ser (0.9.5-0.1) unstable; urgency=low
 
   * new upstream release (bug fixes) 

+ 4 - 2
mem/f_malloc.c

@@ -35,6 +35,7 @@
  *  2004-11-10  support for > 4Gb mem., switched to long (andrei)
  *  2005-12-12  fixed realloc shrink real_used accounting (andrei)
  *              fixed initial size (andrei)
+ *  2006-02-03  fixed realloc out of mem. free bug (andrei)
  */
 
 
@@ -449,7 +450,7 @@ void* fm_realloc(struct fm_block* qm, void* p, unsigned long size)
 	#else
 			ptr=fm_malloc(qm, size);
 	#endif
-			if (ptr)
+			if (ptr){
 				/* copy, need by libssl */
 				memcpy(ptr, p, orig_size);
 	#ifdef DBG_F_MALLOC
@@ -457,8 +458,9 @@ void* fm_realloc(struct fm_block* qm, void* p, unsigned long size)
 	#else
 				fm_free(qm, p);
 	#endif
-				p=ptr;
 			}
+			p=ptr;
+		}
 	}else{
 		/* do nothing */
 #ifdef DBG_F_MALLOC

+ 3 - 1
mem/q_malloc.c

@@ -36,6 +36,7 @@
  *  2004-11-10  support for > 4Gb mem., switched to long (andrei)
  *  2005-12-12  fixed realloc shrink real_used & used accounting;
  *              fixed initial size (andrei)
+ *  2006-02-03  fixed realloc out of mem. free bug (andrei)
  */
 
 
@@ -598,7 +599,7 @@ void* qm_realloc(struct qm_block* qm, void* p, unsigned long size)
 	#else
 				ptr=qm_malloc(qm, size);
 	#endif
-				if (ptr)
+				if (ptr){
 					/* copy, need by libssl */
 					memcpy(ptr, p, orig_size);
 	#ifdef DBG_QM_MALLOC
@@ -606,6 +607,7 @@ void* qm_realloc(struct qm_block* qm, void* p, unsigned long size)
 	#else
 					qm_free(qm, p);
 	#endif
+				}
 				p=ptr;
 			}
 	}else{