diff --git a/src/plugins/select/bluegene/block_allocator/block_allocator.c b/src/plugins/select/bluegene/block_allocator/block_allocator.c
index 931b1d7d6bcb25b2590ba654489517c5cd7321e6..6689904dcc2d68d8947baa867aa3889f669796b0 100644
--- a/src/plugins/select/bluegene/block_allocator/block_allocator.c
+++ b/src/plugins/select/bluegene/block_allocator/block_allocator.c
@@ -3606,6 +3606,7 @@ static int _find_passthrough(ba_switch_t *curr_switch, int source_port,
 	path_add->in = source_port;
 	
 	if(count>=best_count) {
+		xfree(path_add);
 		return 0;
 	}
 
@@ -3794,9 +3795,10 @@ static int _finish_torus(ba_switch_t *curr_switch, int source_port,
 	path_add->dim = dim;
 	path_add->in = source_port;
 
-	if(count>=best_count)
+	if(count>=best_count) {
+		xfree(path_add);
 		return 0;
-		
+	}
 	if(node_tar[X] == start[X] 
 #ifdef HAVE_BG
 	    && node_tar[Y] == start[Y]