Explorar el Código

mem/f_malloc: free old pointer if allocation in realloc fails

(cherry picked from commit 41a37b570758445d723d4d78b9786f8e6cb5722c)
(cherry picked from commit ce46f5482f56378beba16c68d1e5af5e5d593008)
Daniel-Constantin Mierla hace 11 años
padre
commit
283b3cbb58
Se han modificado 1 ficheros con 3 adiciones y 3 borrados
  1. 3 3
      mem/f_malloc.c

+ 3 - 3
mem/f_malloc.c

@@ -700,12 +700,12 @@ void* fm_realloc(struct fm_block* qm, void* p, unsigned long size)
 			if (ptr){
 				/* copy, need by libssl */
 				memcpy(ptr, p, orig_size);
+			}
 	#ifdef DBG_F_MALLOC
-				fm_free(qm, p, file, func, line);
+			fm_free(qm, p, file, func, line);
 	#else
-				fm_free(qm, p);
+			fm_free(qm, p);
 	#endif
-			}
 			p=ptr;
 		}
 	}else{