File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -450,14 +450,18 @@ REBYTE *evoke_help = "Evoke values:\n"
450
450
memcpy (BIN_HEAD (ser ), codi .data , codi .len );
451
451
Set_Binary (D_RET , ser );
452
452
if (result != CODI_BINARY ) VAL_SET (D_RET , REB_STRING );
453
- // Free the binary!
453
+
454
+ // See notice in reb-codec.h on reb_codec_image
455
+ Free_Mem (codi .data , codi .len );
454
456
break ;
455
457
456
458
case CODI_IMAGE :
457
459
ser = Make_Image (codi .w , codi .h , TRUE); // Puts it into RETURN stack position
458
460
memcpy (IMG_DATA (ser ), codi .bits , codi .w * codi .h * 4 );
459
461
SET_IMAGE (D_RET , ser );
460
- // Free the image!
462
+
463
+ // See notice in reb-codec.h on reb_codec_image
464
+ Free_Mem (codi .bits , codi .w * codi .h * 4 );
461
465
break ;
462
466
463
467
case CODI_BLOCK :
Original file line number Diff line number Diff line change 29
29
#define CODI_DEFINED
30
30
31
31
// Codec image interface:
32
+ //
33
+ // If your codec routine returns CODI_IMAGE, it is expected that the
34
+ // ->bits field contains a block of memory allocated with Make_Mem
35
+ // of size (->w * ->h * 4). This will be freed by the
36
+ // REBNATIVE(do_codec) in n-system.c
37
+ //
38
+ // If your codec routine returns CODI_BINARY or CODI_TEXT, it is
39
+ // expected that the ->data field contains a block of memory
40
+ // allocated with Make_Mem of size ->len. This will be freed by
41
+ // the REBNATIVE(do_codec) in n-system.c
42
+ //
32
43
typedef struct reb_codec_image {
33
44
int action ;
34
45
int w ;
You can’t perform that action at this time.
0 commit comments