Skip to content

Commit 7a5b6b7

Browse files
authored
Removes double free (#42)
alloca already deallocates.
1 parent faee0d8 commit 7a5b6b7

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

src/ArrayFire/Graphics.hs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ drawImage (Window wfptr) (Array fptr) cell =
119119
alloca $ \cellPtr -> do
120120
poke cellPtr =<< cellToAFCell cell
121121
throwAFError =<< af_draw_image wptr aptr cellPtr
122-
free cellPtr
123122

124123
-- | Draw a plot onto a 'Window'
125124
--
@@ -146,7 +145,6 @@ drawPlot (Window w) (Array fptr1) (Array fptr2) cell =
146145
alloca $ \cellPtr -> do
147146
poke cellPtr =<< cellToAFCell cell
148147
throwAFError =<< af_draw_plot wptr ptr1 ptr2 cellPtr
149-
free cellPtr
150148

151149
-- | Draw a plot onto a 'Window'
152150
--
@@ -168,7 +166,6 @@ drawPlot3 (Window w) (Array fptr) cell =
168166
alloca $ \cellPtr -> do
169167
poke cellPtr =<< cellToAFCell cell
170168
throwAFError =<< af_draw_plot3 wptr aptr cellPtr
171-
free cellPtr
172169

173170
-- | Draw a plot onto a 'Window'
174171
--
@@ -190,7 +187,6 @@ drawPlotNd (Window w) (Array fptr) cell =
190187
alloca $ \cellPtr -> do
191188
poke cellPtr =<< cellToAFCell cell
192189
throwAFError =<< af_draw_plot_nd wptr aptr cellPtr
193-
free cellPtr
194190

195191
-- | Draw a plot onto a 'Window'
196192
--
@@ -215,7 +211,6 @@ drawPlot2d (Window w) (Array fptr1) (Array fptr2) cell =
215211
alloca $ \cellPtr -> do
216212
poke cellPtr =<< cellToAFCell cell
217213
throwAFError =<< af_draw_plot_2d wptr ptr1 ptr2 cellPtr
218-
free cellPtr
219214

220215
-- | Draw a 3D plot onto a 'Window'
221216
--
@@ -243,7 +238,6 @@ drawPlot3d (Window w) (Array fptr1) (Array fptr2) (Array fptr3) cell =
243238
alloca $ \cellPtr -> do
244239
poke cellPtr =<< cellToAFCell cell
245240
throwAFError =<< af_draw_plot_3d wptr ptr1 ptr2 ptr3 cellPtr
246-
free cellPtr
247241

248242
-- | Draw a scatter plot onto a 'Window'
249243
--
@@ -270,7 +264,6 @@ drawScatter (Window w) (Array fptr1) (Array fptr2) (fromMarkerType -> m) cell =
270264
alloca $ \cellPtr -> do
271265
poke cellPtr =<< cellToAFCell cell
272266
throwAFError =<< af_draw_scatter wptr ptr1 ptr2 m cellPtr
273-
free cellPtr
274267

275268
-- | Draw a scatter plot onto a 'Window'
276269
--
@@ -294,7 +287,6 @@ drawScatter3 (Window w) (Array fptr1) (fromMarkerType -> m) cell =
294287
alloca $ \cellPtr -> do
295288
poke cellPtr =<< cellToAFCell cell
296289
throwAFError =<< af_draw_scatter3 wptr ptr1 m cellPtr
297-
free cellPtr
298290

299291
-- | Draw a scatter plot onto a 'Window'
300292
--
@@ -318,7 +310,6 @@ drawScatterNd (Window w) (Array fptr1) (fromMarkerType -> m) cell =
318310
alloca $ \cellPtr -> do
319311
poke cellPtr =<< cellToAFCell cell
320312
throwAFError =<< af_draw_scatter_nd wptr ptr1 m cellPtr
321-
free cellPtr
322313

323314
-- | Draw a scatter plot onto a 'Window'
324315
--
@@ -345,7 +336,6 @@ drawScatter2d (Window w) (Array fptr1) (Array fptr2) (fromMarkerType -> m) cell
345336
alloca $ \cellPtr -> do
346337
poke cellPtr =<< cellToAFCell cell
347338
throwAFError =<< af_draw_scatter_2d wptr ptr1 ptr2 m cellPtr
348-
free cellPtr
349339

350340
-- | Draw a scatter plot onto a 'Window'
351341
--
@@ -375,7 +365,6 @@ drawScatter3d (Window w) (Array fptr1) (Array fptr2) (Array fptr3) (fromMarkerTy
375365
alloca $ \cellPtr -> do
376366
poke cellPtr =<< cellToAFCell cell
377367
throwAFError =<< af_draw_scatter_3d wptr ptr1 ptr2 ptr3 m cellPtr
378-
free cellPtr
379368

380369
-- | Draw a Histogram onto a 'Window'
381370
--
@@ -428,7 +417,6 @@ drawSurface (Window w) (Array fptr1) (Array fptr2) (Array fptr3) cell =
428417
alloca $ \cellPtr -> do
429418
poke cellPtr =<< cellToAFCell cell
430419
throwAFError =<< af_draw_surface wptr ptr1 ptr2 ptr3 cellPtr
431-
free cellPtr
432420

433421
-- | Draw a Vector Field onto a 'Window'
434422
--
@@ -453,7 +441,6 @@ drawVectorFieldND (Window w) (Array fptr1) (Array fptr2) cell =
453441
alloca $ \cellPtr -> do
454442
poke cellPtr =<< cellToAFCell cell
455443
throwAFError =<< af_draw_vector_field_nd wptr ptr1 ptr2 cellPtr
456-
free cellPtr
457444

458445
-- | Draw a Vector Field onto a 'Window'
459446
--
@@ -492,7 +479,6 @@ drawVectorField3d (Window w) (Array fptr1) (Array fptr2) (Array fptr3)
492479
alloca $ \cellPtr -> do
493480
poke cellPtr =<< cellToAFCell cell
494481
throwAFError =<< af_draw_vector_field_3d wptr ptr1 ptr2 ptr3 ptr4 ptr5 ptr6 cellPtr
495-
free cellPtr
496482

497483
-- | Draw a Vector Field onto a 'Window'
498484
--
@@ -524,7 +510,6 @@ drawVectorField2d (Window w) (Array fptr1) (Array fptr2) (Array fptr3) (Array fp
524510
alloca $ \cellPtr -> do
525511
poke cellPtr =<< cellToAFCell cell
526512
throwAFError =<< af_draw_vector_field_2d wptr ptr1 ptr2 ptr3 ptr4 cellPtr
527-
free cellPtr
528513

529514
-- | Draw a grid onto a 'Window'
530515
--
@@ -573,7 +558,6 @@ setAxesLimitsCompute (Window w) (Array fptr1) (Array fptr2) (Array fptr3) (fromI
573558
alloca $ \cellPtr -> do
574559
poke cellPtr =<< cellToAFCell cell
575560
throwAFError =<< af_set_axes_limits_compute wptr ptr1 ptr2 ptr3 exact cellPtr
576-
free cellPtr
577561

578562
-- | Setting axes limits for a 2D histogram/plot/surface/vector field.
579563
--
@@ -601,7 +585,6 @@ setAxesLimits2d (Window w) xmin xmax ymin ymax (fromIntegral . fromEnum -> exact
601585
alloca $ \cellPtr -> do
602586
poke cellPtr =<< cellToAFCell cell
603587
throwAFError =<< af_set_axes_limits_2d wptr xmin xmax ymin ymax exact cellPtr
604-
free cellPtr
605588

606589
-- | Setting axes limits for a 3D histogram/plot/surface/vector field.
607590
--
@@ -633,7 +616,6 @@ setAxesLimits3d (Window w) xmin xmax ymin ymax zmin zmax (fromIntegral . fromEnu
633616
alloca $ \cellPtr -> do
634617
poke cellPtr =<< cellToAFCell cell
635618
throwAFError =<< af_set_axes_limits_3d wptr xmin xmax ymin ymax zmin zmax exact cellPtr
636-
free cellPtr
637619

638620

639621
-- | Setting axes titles
@@ -661,7 +643,6 @@ setAxesTitles (Window w) x y z cell =
661643
withCString z $ \zstr -> do
662644
poke cellPtr =<< cellToAFCell cell
663645
throwAFError =<< af_set_axes_titles wptr xstr ystr zstr cellPtr
664-
free cellPtr
665646

666647
-- | Displays 'Window'
667648
--

0 commit comments

Comments
 (0)