Skip to content

Commit aaee6e6

Browse files
committed
minor
1 parent a4768f1 commit aaee6e6

File tree

8 files changed

+14
-6
lines changed

8 files changed

+14
-6
lines changed

cairo-draw.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ int main() {
1616
cairo_stroke(cr);
1717

1818
cairo_destroy(cr);
19-
2019
cairo_surface_write_to_png(cairo_surface, "out.png");
2120
cairo_surface_destroy(cairo_surface);
22-
}
21+
}

fribidi-bidi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ int main() {
3131
free(btypes);
3232
free(levels);
3333
return 0;
34-
}
34+
}

harfbuzz-shape.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
int main() {
88
hb_blob_t *blob = hb_blob_create_from_file("input/Roboto.abc.ttf");
9+
// or read the file yourself into buf and use,
10+
// hb_blob_create(buf, len, HB_MEMORY_MODE_WRITABLE, buf, free);
911
hb_face_t *face = hb_face_create(blob, 0);
1012
hb_blob_destroy(blob);
1113
hb_font_t *font = hb_font_create(face);
@@ -17,7 +19,7 @@ int main() {
1719
hb_buffer_t *buffer = hb_buffer_create();
1820
hb_buffer_add_utf8(buffer, "abc", -1, 0, -1);
1921
hb_buffer_guess_segment_properties(buffer);
20-
// or these instead instead guess:
22+
// or use these instead guess:
2123
// hb_buffer_set_direction(buffer, HB_DIRECTION_LTR);
2224
// hb_buffer_set_script(buffer, HB_SCRIPT_LATIN);
2325
hb_shape(font, buffer, NULL, 0);
@@ -43,4 +45,4 @@ int main() {
4345
hb_font_destroy(font);
4446

4547
return 0;
46-
}
48+
}

libjpeg-decode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ int main() {
4343
}
4444
unsigned width, height;
4545
uint8_t *image = decode(buf, len, &width, &height);
46+
free(buf);
4647
{
4748
FILE *f = fopen("out.pbm", "wb");
4849
fprintf(f, "P6 %d %d 255\n", width, height);

libpng-decode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ int main(int argc, char **argv) {
7373
unsigned width, height;
7474
int color_type;
7575
uint8_t *image = decode(buf, len, &width, &height, &color_type);
76+
free(buf);
7677

7778
if (color_type != PNG_COLOR_TYPE_RGB_ALPHA) {
7879
printf("Only RGBA types are supported for the rest of the example for now");

librsvg-render.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// gcc librsvg-render.c `pkg-config --libs --cflags librsvg-2.0` -Wall && ./a.out
2-
#include <librsvg/rsvg.h>
32
#include <stdio.h>
43
#include <stdlib.h>
54

5+
#include <librsvg/rsvg.h>
6+
67
int main() {
78
uint8_t *buf;
89
unsigned len;
@@ -18,6 +19,7 @@ int main() {
1819

1920
GError *error = NULL;
2021
RsvgHandle *handle = rsvg_handle_new_from_data(buf, len, &error);
22+
free(buf);
2123
if (error)
2224
return 1;
2325
RsvgDimensionData dim;
@@ -30,4 +32,5 @@ int main() {
3032
cairo_destroy(cr);
3133
cairo_surface_write_to_png(cairo_surface, "out.png");
3234
cairo_surface_destroy(cairo_surface);
35+
return 0;
3336
}

libwebp-decode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ int main() {
1818
}
1919
int width, height;
2020
uint8_t *image = WebPDecodeRGB(buf, len, &width, &height);
21+
free(buf);
2122
{
2223
FILE *f = fopen("out.pbm", "wb");
2324
fprintf(f, "P6 %d %d 255\n", width, height);

libzstd-decode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ int main() {
1919
unsigned dst_size = ZSTD_getFrameContentSize(src, src_size);
2020
uint8_t *dst = malloc(dst_size);
2121
ZSTD_decompress(dst, dst_size, src, src_size);
22+
free(src);
2223
printf("%.*s", dst_size, dst);
2324
free(dst);
2425
return 0;

0 commit comments

Comments
 (0)