Browse code

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 authored on 03/02/2006 21:08:06
Showing 4 changed files
... ...
@@ -58,8 +58,8 @@ MAIN_NAME=ser
58 58
 #version number
59 59
 VERSION = 0
60 60
 PATCHLEVEL = 9
61
-SUBLEVEL = 6
62
-EXTRAVERSION = 
61
+SUBLEVEL = 7
62
+EXTRAVERSION = -pre1
63 63
 
64 64
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
65 65
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
... ...
@@ -1,3 +1,9 @@
1
+ser (0.9.6-0.1) unstable; urgency=low
2
+
3
+  * new upstream release (bug fixes) 
4
+
5
+ -- Andrei Pelinescu-Onciul <andrei@iptel.org>  Mon, 16 Jan 2006 20:02:52 +0200
6
+
1 7
 ser (0.9.5-0.1) unstable; urgency=low
2 8
 
3 9
   * new upstream release (bug fixes) 
... ...
@@ -35,6 +35,7 @@
35 35
  *  2004-11-10  support for > 4Gb mem., switched to long (andrei)
36 36
  *  2005-12-12  fixed realloc shrink real_used accounting (andrei)
37 37
  *              fixed initial size (andrei)
38
+ *  2006-02-03  fixed realloc out of mem. free bug (andrei)
38 39
  */
39 40
 
40 41
 
... ...
@@ -449,7 +450,7 @@ void* fm_realloc(struct fm_block* qm, void* p, unsigned long size)
449 450
 	#else
450 451
 			ptr=fm_malloc(qm, size);
451 452
 	#endif
452
-			if (ptr)
453
+			if (ptr){
453 454
 				/* copy, need by libssl */
454 455
 				memcpy(ptr, p, orig_size);
455 456
 	#ifdef DBG_F_MALLOC
... ...
@@ -457,8 +458,9 @@ void* fm_realloc(struct fm_block* qm, void* p, unsigned long size)
457 458
 	#else
458 459
 				fm_free(qm, p);
459 460
 	#endif
460
-				p=ptr;
461 461
 			}
462
+			p=ptr;
463
+		}
462 464
 	}else{
463 465
 		/* do nothing */
464 466
 #ifdef DBG_F_MALLOC
... ...
@@ -36,6 +36,7 @@
36 36
  *  2004-11-10  support for > 4Gb mem., switched to long (andrei)
37 37
  *  2005-12-12  fixed realloc shrink real_used & used accounting;
38 38
  *              fixed initial size (andrei)
39
+ *  2006-02-03  fixed realloc out of mem. free bug (andrei)
39 40
  */
40 41
 
41 42
 
... ...
@@ -598,7 +599,7 @@ void* qm_realloc(struct qm_block* qm, void* p, unsigned long size)
598 599
 	#else
599 600
 				ptr=qm_malloc(qm, size);
600 601
 	#endif
601
-				if (ptr)
602
+				if (ptr){
602 603
 					/* copy, need by libssl */
603 604
 					memcpy(ptr, p, orig_size);
604 605
 	#ifdef DBG_QM_MALLOC
... ...
@@ -606,6 +607,7 @@ void* qm_realloc(struct qm_block* qm, void* p, unsigned long size)
606 607
 	#else
607 608
 					qm_free(qm, p);
608 609
 	#endif
610
+				}
609 611
 				p=ptr;
610 612
 			}
611 613
 	}else{