Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track down leaked ptp_getobjectinfo results #690

Closed
RReverser opened this issue Jul 23, 2021 · 43 comments
Closed

Track down leaked ptp_getobjectinfo results #690

RReverser opened this issue Jul 23, 2021 · 43 comments
Assignees

Comments

@RReverser
Copy link
Contributor

RReverser commented Jul 23, 2021

Originally reported in #689 (comment), copying here for a separate tracking issue: most usages of ptp_getobjectinfo seem to leak the resulting heap-allocated strings and must call ptp_freeobjectinfo.

Or, perhaps a more systematic fix is necessary - for example, PTPObjectInfo could be changed to contain fixed-length char arrays and sidestep this problem altogether.


mainly the objectinfos go into the PTPObjects and are freed from there.

Maybe I missed a few, but I haven't seem examples of that.

E.g. from the same file, the Fuji switch below:

ret = ptp_getobjectinfo (params, preview_object, &oi);
. As far as I can tell, this oi will also be leaked like the Sony one.

Same for this one:

C_PTP_MSG (ptp_getobjectinfo (params, event.Param1, &oi),

Or here:

C_PTP (ptp_getobjectinfo (params, newobject, &oi));

...and there are many others.

@msmeissn
Copy link
Contributor

i did a first pass. I however need to now test as many of those cameras as I can in case I made a mistake ;)

@RReverser
Copy link
Contributor Author

Nice, thanks! Yeah, testing was my concern too - unfortunately, I don't have many cameras to verify it on.

@notnot
Copy link

notnot commented Jul 31, 2021

Since a few weeks i installed 2.5.27, and have also discovered a growing memory usage when running live previews. I have a machine vision system that is running non-stop and this memory leak will eventually lead to a fatal Out of Memory error. That system can't run for more than two days now...
I will download and install libgphoto2 master today and see how it goes. Camera used is the Sony A6300, so i can't contribute to wider testing on other camera types.

@RReverser
Copy link
Contributor Author

@notnot That one should be fixed by #689, at least I didn't find any more leaks for Sony a6600 live view afterwards.

@RReverser
Copy link
Contributor Author

It's strange that this issue went unnoticed for such a long time though... as far as I can tell, most of the relevant code has been unchanged for years?

@notnot
Copy link

notnot commented Jul 31, 2021

@notnot That one should be fixed by #689, at least I didn't find any more leaks for Sony a6600 live view afterwards.

Have you also looked for leaks associated with capture and download of images? My application does that a lot as well, if it sees something interesting in the preview. I will monitor memory usage and hopefully all the memory leaks are gone now!

@notnot
Copy link

notnot commented Jul 31, 2021

It's strange that this issue went unnoticed for such a long time though... as far as I can tell, most of the relevant code has been unchanged for years?

What is the magnitude of the leaked memory you were seeing? I am seeing on average 10.5 MB per hour, when capturing 25 previews a second. I measured the memory use of my application every 5 minutes, with the (ubuntu) system monitor, and the memory growth isn't linear.

For example:
00 minutes : 26.2 MB
05 minutes : 27.9 MB (+ 1.7 MB)
10 minutes : 30.0 MB (+ 2.1 MB)
15 minutes : 30.6 MB (+ 0.6 MB)
20 minutes : 30.9 MB (+ 0.3 MB)
25 minutes : 31.1 MB (+ 0.2 MB)
30 minutes : 33.7 MB (+ 2.6 MB)
35 minutes : 34.3 MB (+ 0.6 MB)
40 minutes : 34.3 MB (0)
45 minutes : 34.9 MB (+ 0.6 MB)
50 minutes : 35.3 MB (+ 0.4 MB)
55 minutes : 36.0 MB (+ 0.7 MB)
60 minutes : 36.7 MB (+ 0.7 MB)

All this time the camera is stationary, pointed at a scene that doesn't change, so the preview data is very similar in size on each new frame.

There is a complication in my setup: i am programming in Go, and i use a wrapper around the C libgphoto2 library. It is possible that there is a flaw in that wrapper. Maybe it doesn't free everything that needs to be freed. I think my next experiment would be to write a pure C program that captures previews as fast as possible and see how the memory usage is, over longer periods of time.

@msmeissn msmeissn self-assigned this Aug 1, 2021
@msmeissn
Copy link
Contributor

msmeissn commented Aug 1, 2021

various live methods have only been added recently in the last 3 years or so FWIW.
the leaks should increate linear with amount of captured frames if the fix is not applied. Please test with fix applied.

@RReverser
Copy link
Contributor Author

I will monitor memory usage and hopefully all the memory leaks are gone now!

@notnot FWIW it's a very slow and unreliable method. Best to compile your code with leak sanitizers or run with Valgrind (I'm not entirely sure which one integrates with Go better). That's how I found the leak above, and ensured that at least my program didn't have any others, no matter how small.

@notnot
Copy link

notnot commented Aug 1, 2021

I will monitor memory usage and hopefully all the memory leaks are gone now!

@notnot FWIW it's a very slow and unreliable method. Best to compile your code with leak sanitizers or run with Valgrind (I'm not entirely sure which one integrates with Go better). That's how I found the leak above, and ensured that at least my program didn't have any others, no matter how small.

Yes this is a crude way of monitoring memory. I will learn about the best ways to do this accurately with Go executables. Go is a garbage collecting language, which is not so simple to reason about :(

In the meantime i did write a minimal C program that captures previews 25 times a second, and i don't see any memory leaks when running it. The huge memory leak that i was seeing in my application must thus be on the Go side. I will investigate the gphoto2 wrapper in detail to find the flaw. Sorry for the noise!

There is still a mystery though: with libgphoto2 2.5.20, which i have been using for some years, my application/machine could run for months without an OOM error. With 2.5.27 it runs for at most 2 days, then it hits an OOM. I didn't change my code, i only upgraded libgphoto2.
I tend to believe that this is not a flaw in libgphoto2, but a flaw in the Go wrapper and/or the way Go handles memory that is allocated externally.

@notnot
Copy link

notnot commented Aug 3, 2021

I spoke too soon... when running the memory leak test for a longer time, i do see a serious leak related to preview captures. This happens in my C test program, so it has nothing to do with the Go wrapper. Note that the older 2.5.20 that i used to use in production doesn't suffer from it. 2.5.27 has it. I am running this test on arm cpu, maybe that matters.
I did notice something peculiar that might explain why a longer test run is needed to see the leak.
In the beginning of preview streaming, the preview data is stored at the same address each time. Usually, after a few hundred previews, the data address changes, it is incrementing. For instance:

frame 346: 26343 bytes of data @ 0x55AFF6CFD0
frame 347: 26262 bytes of data @ 0x55AFF6CFD0
frame 348: 26254 bytes of data @ 0x55AFF6CFD0
frame 349: 26273 bytes of data @ 0x55AFF6CFD0
frame 350: 26350 bytes of data @ 0x55AFF6CFD0
frame 351: 26271 bytes of data @ 0x55AFF6CFD0
frame 352: 26323 bytes of data @ 0x55AFF6CFD0
frame 353: 26309 bytes of data @ 0x55AFF6CFF0
frame 354: 26314 bytes of data @ 0x55AFF6D050
frame 355: 26299 bytes of data @ 0x55AFF6D090
frame 356: 26251 bytes of data @ 0x55AFF6D0D0
frame 357: 26318 bytes of data @ 0x55AFF6D130
frame 358: 26317 bytes of data @ 0x55AFF6D170
frame 359: 26345 bytes of data @ 0x55AFF6D1D0
frame 360: 26344 bytes of data @ 0x55AFF6D210
frame 361: 26289 bytes of data @ 0x55AFF6D270
frame 362: 26325 bytes of data @ 0x55AFF6D2B0

In 2.5.20 the preview data is always stored at the same address, at least it is on another of my machines where i tested on too. No memory leaks there, even after an hour of previews at 25 FPS.

It is possible that my C test program is not correct, i include it here, so that you can verify it:

// gphoto2.c, jpad 2021
// Test libgphoto2 live preview

#include <stdio.h>
#include <stdlib.h>

#include <gphoto2/gphoto2.h>

int main(int argc, char **argv)
{
printf("libgphoto2 live preview\n");

// initialize a context
GPContext* context = gp_context_new();
if (context == NULL) {
    printf("gp_context_new() failed\n");
    return 1;
}
printf("gphoto2 context initialized\n");

// initialize a camera
Camera* camera; 
gp_camera_new(&camera);
if (camera == NULL) {
    printf("gp_camera_new() failed\n");
    return 1;
}
int r = gp_camera_init(camera, context);
if (r != GP_OK) {
    printf("gp_camera_init(): %d\n", r);
    return 1;
}
printf("initialized camera\n");

// get previews
int count = 0;
while (count < 1000000000) {
    CameraFile *file;
    int r = gp_file_new(&file);
    if (r != GP_OK) {
        printf("gp_file_new(): %d\n", r);
        return 1;
    }

    r = gp_camera_capture_preview(camera, file, context);
    if (r != GP_OK) {
        printf("gp_camera_capture_preview(): %d\n", r);
        return 1;
    }

    // peek at the data
    const char* data;
    ulong len;
    gp_file_get_data_and_size(file, &data, &len);
    printf("frame %d: %d bytes of data @ 0x%lX\n",
        count, (int)len, (ulong)data);

    //gp_file_unref(file);
    gp_file_free(file);

    count++;
}

// free camera
gp_camera_exit(camera, context);
gp_camera_unref(camera);

// free context
gp_context_unref(context);

return 0;

}

If you need more info on my setup, please tell me how to provide it. My computer vision machine is running on a nVidia Jeston Nano computer.

@notnot
Copy link

notnot commented Aug 3, 2021

Note that i tried both gp_file_unref() and gp_file_free(). No difference. Or should i use both?

@RReverser
Copy link
Contributor Author

2.5.27 has it.

Just to be clear - 2.5.27 release or the master of the repo (2.5.27.1)? Only the master has the fix for the leak.

@notnot
Copy link

notnot commented Aug 3, 2021

Of course i have applied the changes.

The leak is serious, for example

time mem

00.00 : 0.8 MB
05:00 : 1.5 MB
10:00 : 2.6 MB
15:00 : 3.2 MB

@RReverser
Copy link
Contributor Author

Can you build with -g -fsanitize=leak so that it can give you stacktraces for what's actually leaking?

@notnot
Copy link

notnot commented Aug 3, 2021

i can try
how to get the stack trace?

@RReverser
Copy link
Contributor Author

It will print it for you upon exit automatically. If you haven't used it before, the docs are pretty good: https://clang.llvm.org/docs/LeakSanitizer.html

You can also reduce number of iterations - just run like 100 previews or so, if there's a leak, it doesn't matter how many you run, it should show up.

@RReverser
Copy link
Contributor Author

If you haven't used it before, the docs are pretty good: clang.llvm.org/docs/LeakSanitizer.html

Er, actually, that page doesn't show just -fsanitize=leak usage, but I guess -fsanitize=address is even better, just in case.

@notnot
Copy link

notnot commented Aug 3, 2021

It will print it for you upon exit automatically. If you haven't used it before, the docs are pretty good: https://clang.llvm.org/docs/LeakSanitizer.html

You can also reduce number of iterations - just run like 100 previews or so, if there's a leak, it doesn't matter how many you run, it should show up.

The thing is... i think the leak comes later on... usually after several hundred previews.. see my earlier discovery of the way that the data location changes... probably related to that

@hfiguiere
Copy link
Member

The thing is... i think the leak comes later on...

Maybe you just notice it at that point, but LeakSanitizer will tell you if you leak 4 bytes...

@RReverser
Copy link
Contributor Author

see my earlier discovery of the way that the data location changes

Data location can change due to allocator fragmentation, it's not much of a symptom by itself usually.

@notnot
Copy link

notnot commented Aug 3, 2021

frame 90: 26413 bytes of data @ 0x7F7E700000
frame 91: 26409 bytes of data @ 0x7F7E700000
frame 92: 26466 bytes of data @ 0x7F7E700000
frame 93: 26392 bytes of data @ 0x7F7E700000
frame 94: 26387 bytes of data @ 0x7F7E700000
frame 95: 26383 bytes of data @ 0x7F7E700000
frame 96: 26391 bytes of data @ 0x7F7E700000
frame 97: 26390 bytes of data @ 0x7F7E700000
frame 98: 26461 bytes of data @ 0x7F7E700000
frame 99: 26446 bytes of data @ 0x7F7E700000

=================================================================
==11311==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
#0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
#1 0x7f83fdc77f (/usr/local/lib/libgphoto2.so.6.1.0+0x5a77f)
#2 0x7f83fdfed3 (/usr/local/lib/libgphoto2.so.6.1.0+0x5ded3)
#3 0x7f83fe3e87 (/usr/local/lib/libgphoto2.so.6.1.0+0x61e87)
#4 0x7f83fe42df (/usr/local/lib/libgphoto2.so.6.1.0+0x622df)
#5 0x7f83fe611f (/usr/local/lib/libgphoto2.so.6.1.0+0x6411f)
#6 0x7f83fe6433 (/usr/local/lib/libgphoto2.so.6.1.0+0x64433)
#7 0x7f83fe7ae7 (/usr/local/lib/libgphoto2.so.6.1.0+0x65ae7)
#8 0x7f84117143 ()
#9 0x7f8411593b (/lib/aarch64-linux-gnu/libpthread-2.27.so+0x2093b)
#10 0x7f8410d057 (/lib/aarch64-linux-gnu/libc-2.27.so+0x16057)
#11 0x7f841556a7 ()
#12 0x7f84265807 in foreach_func /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c:234
#13 0x7f8424dab7 (/usr/lib/aarch64-linux-gnu/libltdl.so.7+0x3ab7)
#14 0x7f8424d4a3 (/usr/lib/aarch64-linux-gnu/libltdl.so.7+0x34a3)
#15 0x7f8424e0b3 in lt_dlforeachfile (/usr/lib/aarch64-linux-gnu/libltdl.so.7+0x40b3)
#16 0x7f84265cbf in gp_port_info_list_load /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c:286
#17 0x7f8445d19b in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:724
#18 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
#19 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
#20 0x555b98bc13 (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
#0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
#1 0x7f83fb677f (/usr/local/lib/libgphoto2.so.6.1.0+0x3477f)
#2 0x7f83fb9ed3 (/usr/local/lib/libgphoto2.so.6.1.0+0x37ed3)
#3 0x7f83fbde87 (/usr/local/lib/libgphoto2.so.6.1.0+0x3be87)
#4 0x7f83fbe2df (/usr/local/lib/libgphoto2.so.6.1.0+0x3c2df)
#5 0x7f83fc011f (/usr/local/lib/libgphoto2.so.6.1.0+0x3e11f)
#6 0x7f83fc0433 (/usr/local/lib/libgphoto2.so.6.1.0+0x3e433)
#7 0x7f83fc1ae7 (/usr/local/lib/libgphoto2.so.6.1.0+0x3fae7)
#8 0x7f83fea143 (/usr/local/lib/libgphoto2.so.6.1.0+0x68143)
#9 0x7f83fe893b (/usr/local/lib/libgphoto2.so.6.1.0+0x6693b)
#10 0x7f83fe0057 (/usr/local/lib/libgphoto2.so.6.1.0+0x5e057)
#11 0x7f84153deb ()
#12 0x7f84268337 in gp_port_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:118
#13 0x7f84268337 in gp_port_set_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:199
#14 0x7f84459f23 in gp_abilities_list_detect /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-abilities-list.c:422
#15 0x7f8445d1b7 in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:725
#16 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
#17 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
#18 0x555b98bc13 (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
#0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
#1 0x7f83fdc77f (/usr/local/lib/libgphoto2.so.6.1.0+0x5a77f)
#2 0x7f83fdfb97 (/usr/local/lib/libgphoto2.so.6.1.0+0x5db97)
#3 0x7f8411711b ()
#4 0x7f8411593b (/lib/aarch64-linux-gnu/libpthread-2.27.so+0x2093b)
#5 0x7f8410d057 (/lib/aarch64-linux-gnu/libc-2.27.so+0x16057)
#6 0x7f841556a7 ()
#7 0x7f84265807 in foreach_func /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c:234
#8 0x7f8424dab7 (/usr/lib/aarch64-linux-gnu/libltdl.so.7+0x3ab7)
#9 0x7f8424d4a3 (/usr/lib/aarch64-linux-gnu/libltdl.so.7+0x34a3)
#10 0x7f8424e0b3 in lt_dlforeachfile (/usr/lib/aarch64-linux-gnu/libltdl.so.7+0x40b3)
#11 0x7f84265cbf in gp_port_info_list_load /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c:286
#12 0x7f8445d19b in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:724
#13 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
#14 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
#15 0x555b98bc13 (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
#0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
#1 0x7f83fdc77f (/usr/local/lib/libgphoto2.so.6.1.0+0x5a77f)
#2 0x7f83fdfed3 (/usr/local/lib/libgphoto2.so.6.1.0+0x5ded3)
#3 0x7f83fe3e87 (/usr/local/lib/libgphoto2.so.6.1.0+0x61e87)
#4 0x7f83fe42df (/usr/local/lib/libgphoto2.so.6.1.0+0x622df)
#5 0x7f83fe611f (/usr/local/lib/libgphoto2.so.6.1.0+0x6411f)
#6 0x7f83fe6433 (/usr/local/lib/libgphoto2.so.6.1.0+0x64433)
#7 0x7f83fe7ae7 (/usr/local/lib/libgphoto2.so.6.1.0+0x65ae7)
#8 0x7f84117143 ()
#9 0x7f8411593b (/lib/aarch64-linux-gnu/libpthread-2.27.so+0x2093b)
#10 0x7f8410d057 (/lib/aarch64-linux-gnu/libc-2.27.so+0x16057)
#11 0x7f84153deb ()
#12 0x7f84268337 in gp_port_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:118
#13 0x7f84268337 in gp_port_set_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:199
#14 0x7f84459f23 in gp_abilities_list_detect /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-abilities-list.c:422
#15 0x7f8445d1b7 in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:725
#16 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
#17 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
#18 0x555b98bc13 (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
#0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
#1 0x7f83fdc77f (/usr/local/lib/libgphoto2.so.6.1.0+0x5a77f)
#2 0x7f83fdfb97 (/usr/local/lib/libgphoto2.so.6.1.0+0x5db97)
#3 0x7f8411711b ()
#4 0x7f8411593b (/lib/aarch64-linux-gnu/libpthread-2.27.so+0x2093b)
#5 0x7f8410d057 (/lib/aarch64-linux-gnu/libc-2.27.so+0x16057)
#6 0x7f84153deb ()
#7 0x7f84268337 in gp_port_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:118
#8 0x7f84268337 in gp_port_set_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:199
#9 0x7f84459f23 in gp_abilities_list_detect /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-abilities-list.c:422
#10 0x7f8445d1b7 in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:725
#11 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
#12 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
#13 0x555b98bc13 (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
#0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
#1 0x7f83fb677f (/usr/local/lib/libgphoto2.so.6.1.0+0x3477f)
#2 0x7f83fb9ed3 (/usr/local/lib/libgphoto2.so.6.1.0+0x37ed3)
#3 0x7f83fbde87 (/usr/local/lib/libgphoto2.so.6.1.0+0x3be87)
#4 0x7f83fbe2df (/usr/local/lib/libgphoto2.so.6.1.0+0x3c2df)
#5 0x7f83fc011f (/usr/local/lib/libgphoto2.so.6.1.0+0x3e11f)
#6 0x7f83fc0433 (/usr/local/lib/libgphoto2.so.6.1.0+0x3e433)
#7 0x7f83fc1ae7 (/usr/local/lib/libgphoto2.so.6.1.0+0x3fae7)
#8 0x7f83fea143 (/usr/local/lib/libgphoto2.so.6.1.0+0x68143)
#9 0x7f83fe893b (/usr/local/lib/libgphoto2.so.6.1.0+0x6693b)
#10 0x7f83fe0057 (/usr/local/lib/libgphoto2.so.6.1.0+0x5e057)
#11 0x7f84153deb ()
#12 0x7f84268337 in gp_port_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:118
#13 0x7f84268337 in gp_port_set_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:199
#14 0x7f8445cb7b in gp_camera_set_port_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:433
#15 0x7f8445d5a7 in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:766
#16 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
#17 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
#18 0x555b98bc13 (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
#0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
#1 0x7f83fb677f (/usr/local/lib/libgphoto2.so.6.1.0+0x3477f)
#2 0x7f83fb9b97 (/usr/local/lib/libgphoto2.so.6.1.0+0x37b97)
#3 0x7f83fea11b (/usr/local/lib/libgphoto2.so.6.1.0+0x6811b)
#4 0x7f83fe893b (/usr/local/lib/libgphoto2.so.6.1.0+0x6693b)
#5 0x7f83fe0057 (/usr/local/lib/libgphoto2.so.6.1.0+0x5e057)
#6 0x7f84153deb ()
#7 0x7f84268337 in gp_port_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:118
#8 0x7f84268337 in gp_port_set_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:199
#9 0x7f8445cb7b in gp_camera_set_port_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:433
#10 0x7f8445d5a7 in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:766
#11 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
#12 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
#13 0x555b98bc13 (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
#0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
#1 0x7f83fb677f (/usr/local/lib/libgphoto2.so.6.1.0+0x3477f)
#2 0x7f83fb9b97 (/usr/local/lib/libgphoto2.so.6.1.0+0x37b97)
#3 0x7f83fea11b (/usr/local/lib/libgphoto2.so.6.1.0+0x6811b)
#4 0x7f83fe893b (/usr/local/lib/libgphoto2.so.6.1.0+0x6693b)
#5 0x7f83fe0057 (/usr/local/lib/libgphoto2.so.6.1.0+0x5e057)
#6 0x7f84153deb ()
#7 0x7f84268337 in gp_port_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:118
#8 0x7f84268337 in gp_port_set_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:199
#9 0x7f84459f23 in gp_abilities_list_detect /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-abilities-list.c:422
#10 0x7f8445d1b7 in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:725
#11 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
#12 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
#13 0x555b98bc13 (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 3159 byte(s) in 243 object(s) allocated from:
#0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
#1 0x7f8437413f in strdup (/lib/aarch64-linux-gnu/libc.so.6+0x7b13f)
#2 0x7f7fe2c9c7 ()
#3 0x7f7fe33947 ()
#4 0x7f7fe47d47 ()
#5 0x7f8446014f in gp_camera_capture_preview /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:1403
#6 0x555b98bdf7 in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xdf7)
#7 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
#8 0x555b98bc13 (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

SUMMARY: LeakSanitizer: 35927 byte(s) leaked in 251 allocation(s).
makefile:16: recipe for target 'run' failed
make: *** [run] Error 23

@RReverser
Copy link
Contributor Author

Nit: it's best to always wrap code, logs, etc. on Github with

```
...
```

Otherwise you just accidentally cc'd a bunch of old issues.

@notnot
Copy link

notnot commented Aug 3, 2021

The above was just 100 preview frames
I hope someone can use this report to pinpoint the problem!

@RReverser
Copy link
Contributor Author

@notnot You can pinpoint it quite easily yourself. Ignore everything coming from gp_port_init - obviously those are not really "leaks" but a normal global init. The last one, however, is more suspicious as it comes from gp_camera_capture_preview:

Direct leak of 3159 byte(s) in 243 object(s) allocated from:
#0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
#1 0x7f8437413f in strdup (/lib/aarch64-linux-gnu/libc.so.6+0x7b13f)
#2 0x7f7fe2c9c7 ()
#3 0x7f7fe33947 ()
#4 0x7f7fe47d47 ()
#5 0x7f8446014f in gp_camera_capture_preview /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:1403
#6 0x555b98bdf7 in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xdf7)
#7 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
#8 0x555b98bc13 (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Unfortunately, looks like your libgphoto2 is built with optimisations and not just a debug build, so it doesn't provide much more info (missing function names).

@RReverser
Copy link
Contributor Author

Make sure to rebuild everything - clean & make libgphoto2 as well as rebuild your own wrapper - with just CFLAGS=-g to disable optimizations and enable debug info.

@RReverser
Copy link
Contributor Author

Ignore everything coming from gp_port_init - obviously those are not really "leaks" but a normal global init.

Btw, if you free camera itself before exit, those spurious leaks should go away too.

@notnot
Copy link

notnot commented Aug 3, 2021

sorry... i'm quite new to this, second attempt with better formatting

frame 90: 26413 bytes of data @ 0x7F7E700000
frame 91: 26409 bytes of data @ 0x7F7E700000
frame 92: 26466 bytes of data @ 0x7F7E700000
frame 93: 26392 bytes of data @ 0x7F7E700000
frame 94: 26387 bytes of data @ 0x7F7E700000
frame 95: 26383 bytes of data @ 0x7F7E700000
frame 96: 26391 bytes of data @ 0x7F7E700000
frame 97: 26390 bytes of data @ 0x7F7E700000
frame 98: 26461 bytes of data @ 0x7F7E700000
frame 99: 26446 bytes of data @ 0x7F7E700000

=================================================================
==11311==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
    #0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
    #1 0x7f83fdc77f  (/usr/local/lib/libgphoto2.so.6.1.0+0x5a77f)
    #2 0x7f83fdfed3  (/usr/local/lib/libgphoto2.so.6.1.0+0x5ded3)
    #3 0x7f83fe3e87  (/usr/local/lib/libgphoto2.so.6.1.0+0x61e87)
    #4 0x7f83fe42df  (/usr/local/lib/libgphoto2.so.6.1.0+0x622df)
    #5 0x7f83fe611f  (/usr/local/lib/libgphoto2.so.6.1.0+0x6411f)
    #6 0x7f83fe6433  (/usr/local/lib/libgphoto2.so.6.1.0+0x64433)
    #7 0x7f83fe7ae7  (/usr/local/lib/libgphoto2.so.6.1.0+0x65ae7)
    #8 0x7f84117143  (<unknown module>)
    #9 0x7f8411593b  (/lib/aarch64-linux-gnu/libpthread-2.27.so+0x2093b)
    #10 0x7f8410d057  (/lib/aarch64-linux-gnu/libc-2.27.so+0x16057)
    #11 0x7f841556a7  (<unknown module>)
    #12 0x7f84265807 in foreach_func /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c:234
    #13 0x7f8424dab7  (/usr/lib/aarch64-linux-gnu/libltdl.so.7+0x3ab7)
    #14 0x7f8424d4a3  (/usr/lib/aarch64-linux-gnu/libltdl.so.7+0x34a3)
    #15 0x7f8424e0b3 in lt_dlforeachfile (/usr/lib/aarch64-linux-gnu/libltdl.so.7+0x40b3)
    #16 0x7f84265cbf in gp_port_info_list_load /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c:286
    #17 0x7f8445d19b in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:724
    #18 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
    #19 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
    #20 0x555b98bc13  (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
    #0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
    #1 0x7f83fb677f  (/usr/local/lib/libgphoto2.so.6.1.0+0x3477f)
    #2 0x7f83fb9ed3  (/usr/local/lib/libgphoto2.so.6.1.0+0x37ed3)
    #3 0x7f83fbde87  (/usr/local/lib/libgphoto2.so.6.1.0+0x3be87)
    #4 0x7f83fbe2df  (/usr/local/lib/libgphoto2.so.6.1.0+0x3c2df)
    #5 0x7f83fc011f  (/usr/local/lib/libgphoto2.so.6.1.0+0x3e11f)
    #6 0x7f83fc0433  (/usr/local/lib/libgphoto2.so.6.1.0+0x3e433)
    #7 0x7f83fc1ae7  (/usr/local/lib/libgphoto2.so.6.1.0+0x3fae7)
    #8 0x7f83fea143  (/usr/local/lib/libgphoto2.so.6.1.0+0x68143)
    #9 0x7f83fe893b  (/usr/local/lib/libgphoto2.so.6.1.0+0x6693b)
    #10 0x7f83fe0057  (/usr/local/lib/libgphoto2.so.6.1.0+0x5e057)
    #11 0x7f84153deb  (<unknown module>)
    #12 0x7f84268337 in gp_port_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:118
    #13 0x7f84268337 in gp_port_set_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:199
    #14 0x7f84459f23 in gp_abilities_list_detect /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-abilities-list.c:422
    #15 0x7f8445d1b7 in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:725
    #16 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
    #17 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
    #18 0x555b98bc13  (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
    #0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
    #1 0x7f83fdc77f  (/usr/local/lib/libgphoto2.so.6.1.0+0x5a77f)
    #2 0x7f83fdfb97  (/usr/local/lib/libgphoto2.so.6.1.0+0x5db97)
    #3 0x7f8411711b  (<unknown module>)
    #4 0x7f8411593b  (/lib/aarch64-linux-gnu/libpthread-2.27.so+0x2093b)
    #5 0x7f8410d057  (/lib/aarch64-linux-gnu/libc-2.27.so+0x16057)
    #6 0x7f841556a7  (<unknown module>)
    #7 0x7f84265807 in foreach_func /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c:234
    #8 0x7f8424dab7  (/usr/lib/aarch64-linux-gnu/libltdl.so.7+0x3ab7)
    #9 0x7f8424d4a3  (/usr/lib/aarch64-linux-gnu/libltdl.so.7+0x34a3)
    #10 0x7f8424e0b3 in lt_dlforeachfile (/usr/lib/aarch64-linux-gnu/libltdl.so.7+0x40b3)
    #11 0x7f84265cbf in gp_port_info_list_load /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c:286
    #12 0x7f8445d19b in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:724
    #13 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
    #14 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
    #15 0x555b98bc13  (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
    #0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
    #1 0x7f83fdc77f  (/usr/local/lib/libgphoto2.so.6.1.0+0x5a77f)
    #2 0x7f83fdfed3  (/usr/local/lib/libgphoto2.so.6.1.0+0x5ded3)
    #3 0x7f83fe3e87  (/usr/local/lib/libgphoto2.so.6.1.0+0x61e87)
    #4 0x7f83fe42df  (/usr/local/lib/libgphoto2.so.6.1.0+0x622df)
    #5 0x7f83fe611f  (/usr/local/lib/libgphoto2.so.6.1.0+0x6411f)
    #6 0x7f83fe6433  (/usr/local/lib/libgphoto2.so.6.1.0+0x64433)
    #7 0x7f83fe7ae7  (/usr/local/lib/libgphoto2.so.6.1.0+0x65ae7)
    #8 0x7f84117143  (<unknown module>)
    #9 0x7f8411593b  (/lib/aarch64-linux-gnu/libpthread-2.27.so+0x2093b)
    #10 0x7f8410d057  (/lib/aarch64-linux-gnu/libc-2.27.so+0x16057)
    #11 0x7f84153deb  (<unknown module>)
    #12 0x7f84268337 in gp_port_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:118
    #13 0x7f84268337 in gp_port_set_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:199
    #14 0x7f84459f23 in gp_abilities_list_detect /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-abilities-list.c:422
    #15 0x7f8445d1b7 in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:725
    #16 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
    #17 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
    #18 0x555b98bc13  (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
    #0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
    #1 0x7f83fdc77f  (/usr/local/lib/libgphoto2.so.6.1.0+0x5a77f)
    #2 0x7f83fdfb97  (/usr/local/lib/libgphoto2.so.6.1.0+0x5db97)
    #3 0x7f8411711b  (<unknown module>)
    #4 0x7f8411593b  (/lib/aarch64-linux-gnu/libpthread-2.27.so+0x2093b)
    #5 0x7f8410d057  (/lib/aarch64-linux-gnu/libc-2.27.so+0x16057)
    #6 0x7f84153deb  (<unknown module>)
    #7 0x7f84268337 in gp_port_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:118
    #8 0x7f84268337 in gp_port_set_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:199
    #9 0x7f84459f23 in gp_abilities_list_detect /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-abilities-list.c:422
    #10 0x7f8445d1b7 in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:725
    #11 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
    #12 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
    #13 0x555b98bc13  (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
    #0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
    #1 0x7f83fb677f  (/usr/local/lib/libgphoto2.so.6.1.0+0x3477f)
    #2 0x7f83fb9ed3  (/usr/local/lib/libgphoto2.so.6.1.0+0x37ed3)
    #3 0x7f83fbde87  (/usr/local/lib/libgphoto2.so.6.1.0+0x3be87)
    #4 0x7f83fbe2df  (/usr/local/lib/libgphoto2.so.6.1.0+0x3c2df)
    #5 0x7f83fc011f  (/usr/local/lib/libgphoto2.so.6.1.0+0x3e11f)
    #6 0x7f83fc0433  (/usr/local/lib/libgphoto2.so.6.1.0+0x3e433)
    #7 0x7f83fc1ae7  (/usr/local/lib/libgphoto2.so.6.1.0+0x3fae7)
    #8 0x7f83fea143  (/usr/local/lib/libgphoto2.so.6.1.0+0x68143)
    #9 0x7f83fe893b  (/usr/local/lib/libgphoto2.so.6.1.0+0x6693b)
    #10 0x7f83fe0057  (/usr/local/lib/libgphoto2.so.6.1.0+0x5e057)
    #11 0x7f84153deb  (<unknown module>)
    #12 0x7f84268337 in gp_port_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:118
    #13 0x7f84268337 in gp_port_set_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:199
    #14 0x7f8445cb7b in gp_camera_set_port_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:433
    #15 0x7f8445d5a7 in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:766
    #16 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
    #17 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
    #18 0x555b98bc13  (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
    #0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
    #1 0x7f83fb677f  (/usr/local/lib/libgphoto2.so.6.1.0+0x3477f)
    #2 0x7f83fb9b97  (/usr/local/lib/libgphoto2.so.6.1.0+0x37b97)
    #3 0x7f83fea11b  (/usr/local/lib/libgphoto2.so.6.1.0+0x6811b)
    #4 0x7f83fe893b  (/usr/local/lib/libgphoto2.so.6.1.0+0x6693b)
    #5 0x7f83fe0057  (/usr/local/lib/libgphoto2.so.6.1.0+0x5e057)
    #6 0x7f84153deb  (<unknown module>)
    #7 0x7f84268337 in gp_port_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:118
    #8 0x7f84268337 in gp_port_set_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:199
    #9 0x7f8445cb7b in gp_camera_set_port_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:433
    #10 0x7f8445d5a7 in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:766
    #11 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
    #12 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
    #13 0x555b98bc13  (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 4096 byte(s) in 1 object(s) allocated from:
    #0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
    #1 0x7f83fb677f  (/usr/local/lib/libgphoto2.so.6.1.0+0x3477f)
    #2 0x7f83fb9b97  (/usr/local/lib/libgphoto2.so.6.1.0+0x37b97)
    #3 0x7f83fea11b  (/usr/local/lib/libgphoto2.so.6.1.0+0x6811b)
    #4 0x7f83fe893b  (/usr/local/lib/libgphoto2.so.6.1.0+0x6693b)
    #5 0x7f83fe0057  (/usr/local/lib/libgphoto2.so.6.1.0+0x5e057)
    #6 0x7f84153deb  (<unknown module>)
    #7 0x7f84268337 in gp_port_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:118
    #8 0x7f84268337 in gp_port_set_info /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2_port/libgphoto2_port/gphoto2-port.c:199
    #9 0x7f84459f23 in gp_abilities_list_detect /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-abilities-list.c:422
    #10 0x7f8445d1b7 in gp_camera_init /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:725
    #11 0x555b98bd7b in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xd7b)
    #12 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
    #13 0x555b98bc13  (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

Direct leak of 3159 byte(s) in 243 object(s) allocated from:
    #0 0x7f844f376f in malloc (/usr/lib/aarch64-linux-gnu/liblsan.so.0+0xe76f)
    #1 0x7f8437413f in strdup (/lib/aarch64-linux-gnu/libc.so.6+0x7b13f)
    #2 0x7f7fe2c9c7  (<unknown module>)
    #3 0x7f7fe33947  (<unknown module>)
    #4 0x7f7fe47d47  (<unknown module>)
    #5 0x7f8446014f in gp_camera_capture_preview /home/jpad/Downloads/installers/libgphoto2-2.5.27/libgphoto2/gphoto2-camera.c:1403
    #6 0x555b98bdf7 in main (/home/jpad/prog/C/test/gphoto2/gphoto2+0xdf7)
    #7 0x7f843196df in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206df)
    #8 0x555b98bc13  (/home/jpad/prog/C/test/gphoto2/gphoto2+0xc13)

SUMMARY: LeakSanitizer: 35927 byte(s) leaked in 251 allocation(s).
makefile:16: recipe for target 'run' failed
make: *** [run] Error 23

@notnot
Copy link

notnot commented Aug 3, 2021

Make sure to rebuild everything - clean & make libgphoto2 as well as rebuild your own wrapper - with just CFLAGS=-g to disable optimizations and enable debug info.

Will attempt that tomorrow, and i'll post the results.
Note that i got these results with a plain C program, the one i listed above. The Go wrapper is not in the picture right now. This is as close to lingrphoto2 that i can get! Aviding complications as much as possible. Maybe you can reproduce it? Or would it be something arm related?

@RReverser
Copy link
Contributor Author

RReverser commented Aug 3, 2021

    #2 0x7f7fe2c9c7  (<unknown module>)
    #3 0x7f7fe33947  (<unknown module>)
    #4 0x7f7fe47d47  (<unknown module>)

suggests there is still some code not rebuilt with debug symbols.

But at least you can take a look at the line it gives at gphoto2-camera.c:1403 right before that.

@RReverser
Copy link
Contributor Author

Maybe you can reproduce it?

As I said above, I didn't see any more leaks in my app, but it could very well be camera-specific.

@notnot
Copy link

notnot commented Aug 3, 2021

Maybe you can reproduce it?

As I said above, I didn't see any more leaks in my app, but it could very well be camera-specific.

I am running this with a Sony A6300, which uses ptp. I figure your A6600 will use the same code paths?

@RReverser
Copy link
Contributor Author

Unfortunately, that line - 1403 - does not correspond to anything on current master, so it appears your copy is still out of date:

But, either way, mind you, I'm not a maintainer or anything - just a fellow user who happened to debug issues that arose with my camera and contributed some fixes and trying to help the best I can :)

I'm sure you'll be able to find out what's causing leaks in your app too, you just need some time to go over those codepaths the leak indicated with a debugger or by inserting some logs.

@notnot
Copy link

notnot commented Aug 3, 2021

Unfortunately, that line - 1403 - does not correspond to anything on current master, so it appears your copy is still out of date:

Yes that is true, i manually applied the changes in the official 2.5.27, because at the location where my machine is, the internet is very very bad. I was even lucky to get the diff page on screen! I should download the current master at home, save it to stick and install it on site. Tomorrow, or the day after...

Thanks for your concerns, i hope Marcus will have a look at it. I lost most of my C skills lol. It feels like i entered the rabbit hole! Good thing is that i can now produce leak sanitizer logs, thanks to you :)

@notnot
Copy link

notnot commented Aug 3, 2021

Line 1403 in my gphoto2-camera-c source:
CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->capture_preview (

@RReverser
Copy link
Contributor Author

Line 1403 in my gphoto2-camera-c source:
CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->capture_preview (

Ah right, that's not very helpful then. A bit too high-level API to tell anything useful. You'll need to clean & recompile the rest with debug flags and without opts as described above to see missing frames and figure out where the leak actually occurs.

@msmeissn
Copy link
Contributor

msmeissn commented Aug 4, 2021

the strdup in the leak trace could just be this ptp_getobjectinfo thing.

build libgphoto2 also with CFLAGS="-O2 -DVALGRIND -g" .... the -DVALGRIND disables the unloading of the camera drivers so their symvbols stay in memory.

@notnot
Copy link

notnot commented Aug 5, 2021

I can confirm that today's master no longer has a preview capture memory leak.

I still have two (not so important) questions:

  1. Why did my earlier 'manual fix' attempt not work? Applying the changes to ptp2/library.c, running 'make' and 'sudo make install'. All the libgphoto2 things that were installed were new (looking at the timestamp). Should i have done 'make clean' as a first step?

  2. How to get rid of the gp_camera_init() related leaks? I am doing gp_camera_exit(camera, context);
    gp_camera_free(camera); but the leaks stay.

@RReverser
Copy link
Contributor Author

I can confirm that today's master has no preview capture memory leak any longer.

Great, glad to hear! Sounds like it should've been came codepath then.

1. Why did my earlier 'manual fix' attempt not work?

You might have missed some commits as the fixes were split between Sony and other cameras. That's why I asked earlier about master:

Just to be clear - 2.5.27 release or the master of the repo (2.5.27.1)? Only the master has the fix for the leak.

How to get rid of the gp_camera_init() related leaks? I am doing gp_camera_exit(camera, context);
gp_camera_free(camera); but the leaks stay.

Judging by the fact those all are coming from gp_port_init, I suspect it's just one-off initialization for the lifetime of the program, and not really a leak in traditional sense, and so can be ignored (@msmeissn please correct me if I'm wrong).

@msmeissn
Copy link
Contributor

msmeissn commented Aug 6, 2021

it is probably just 1 time initialization, yes. without better debug symbols its a bit hard to say.

(But I see similar one time leaks here.)

@RReverser
Copy link
Contributor Author

I think it's fair to close this issue for now; testing-wise I assume people will report new issues when they run into problems.

It could be really nice if gphoto tests could be automated somehow, but I doubt it's possible without some sort of full-grown camera emulators (or a server with a bunch of cameras connected somewhere).

@msmeissn
Copy link
Contributor

msmeissn commented Aug 7, 2021

yes

@RReverser
Copy link
Contributor Author

I wonder if it makes sense to at least build and ship gphoto2 CLI with -fsanitize=leak.

Unlike full-on address sanitizer, it has very low overhead (definitely negligible compared to USB I/O speed as well as those sleeps here and there) and it could help people report any leaks they run into with their cameras in the wild.

(The false leaks above can be configured to be excluded so people won't see any leaks that are not real.)

clrpackages pushed a commit to clearlinux-pkgs/libgphoto2 that referenced this issue Jan 17, 2022
…on 2.5.28

Arkell Rasiah (2):
      camlibs/ptp2/ptp-pack.c: Fix get-config aperture for R5.
      camlibs/ptp2/ptp-pack.c: Qualify previous change only for olcver=0x13 cameras.

Daniel Schulte (20):
      camlibs/ptp2: Always return after PTP/IP IO errors (#595)
      WIP: Make PTP/IP implementation work on Windows (#596)
      gp_camera_exit: Return result of camera exit function if possible
      camlibs/ptp2: Better cross-platform error handling
      camlibs/ptp2: fuji: Also close jpg socket if connection fails
      camlibs/ptp2: Better network timeout handling
      camlibs/ptp2: Add more error handling to camera_exit
      camlibs/ptp2: Add timeout support for connect/read/write socket operations
      camlibs/ptp2: Reduce log level of debug message
      camlibs/ptp2: Unpack Canon EOS changes for INT32 properties
      camlibs/ptp2: fuji: Fix property datatype in camera_trigger_capture
      camlibs/ptp2: fuji: Ignore added preview object while live-view is active
      camlibs/ptp2: Add Fuji priority mode setting
      camlibs/ptp2: fuji: Use PriorityMode define in camera (un)prepare code
      camlibs/ptp2: Fuji: Fix some PTP/IP error messages
      camlibs/ptp2: Fuji: camera_trigger_camera: Poll slower
      camlibs/ptp2: Don't send final ptp_initiatecapture with Fuji cameras
      camlibs/ptp2: Fuji PTP/IP init packet must have length 82
      camlibs/ptp2: Fuji: When connecting via PTP/IP try to connect twice
      Add add missing ISO values from Canon EOS R6

David Rosca (3):
      ptp2: Disconnect PTP/IP connection in camera_exit
      filesys: Add gp_filesystem_set_info_dirty
      ptp2: Reload object info on PTP_CANON_EOS_CHANGES_TYPE_OBJECTINFO_CHANGE

Gergely Erdélyi (1):
      Add model detection for Fujifilm X100V (#627)

Hans Ulrich Niedermann (112):
      Fix typos found by codespell in *.m4
      gitignore: Anchor patterns at top_srcdir
      gitignore: Add /tmpwrk*/
      Fix grammar and spelling in comments and text
      Remove obsolete gp2ddb (gphoto2 device database) idea
      configure.ac: Avoid po-directories error
      Use AC_SEARCH_LIBS to find where mmap(2) is defined
      gh workflows: remove requirements for flex, bison
      INSTALL: add gtk-doc Debian package name
      Document using GP_CAMLIB_SET on make command line
      Run libgphoto2_port tests only AFTER building iolibs
      Leave comment in Makefile.am about subdir sequence
      gitignore: Add a few forgotten files for in-source-tree builds
      Remove remnants of OS/2 support
      use the proper word
      fix broken check of CPP macro definition after #elif
      Terminate assignment with semicolon instead of comma
      Fix parameters being marked unused when they are being used
      Use proper format string for FDHANDLE type
      comment out unused constant/variable definition
      Use consistently named non-reserved CPP macros for header files
      Use a single definition of BayerTile enum
      utf-8: Convert ISO-8859 text to UTF-8
      utf-8: change xml/html from iso-8859-1 to utf-8
      utf-8: fix weird minus/hyphen character
      utf-8: convert old camlibs/**/*.txt files from latin1
      Remove cvs-tags make target
      HACKING.md: Update include guard macro name
      Use same autoconf requirement in libgphoto2_port
      Group iolib list related definitions
      Avoid accidental include file name collisions
      Rename bayer.[ch] to stv0680-bayer.[ch]
      Use common code for defining iolibdir and camlibdir
      Make CAMLIBS and IOLIBS fallbacks configurable
      Replace --with-foodir= argument by foodir= variable
      Fix check output for DEFAULT_CAMLIBS and DEFAULT_IOLIBS
      test-camera-list: Add --help output
      test-camera-list: Widen column for 4 digit number of camlibs
      Remove unused remnants of convenience libltdl
      Sync gp-byteorder.m4, supporting 64bit values
      Use && and || instead of test arguments -a and -o
      Remove rpm packaging
      Remove unused code adding x bit to *.sh
      Remove linux-hotplug support
      Update libphoto2_port/po/de.po to UTF-8 after all
      NEWS: converted text from iso to utf-8, removed linux-hotplug
      Typo fix: It is _SOURCES, not _SOURCE
      example: include <unistd.h> for close(2), unlink(2), getpid(2)
      tp6081-dump: include <unistd.h> for close(2), add more static
      Here document: Use <<EOF everywhere
      sync gp-check-library.m4 between gphoto-m4 dirs
      Factor out i18n stuff into separate i18n.h files
      Delete old debug comments
      library versioning comment without trailing spaces
      examples: Force #include beginning with "libgphoto2/"
      Rename libgphoto2_port test directory tests
      POTFILES.in: Add ptpip, vusb iolibs
      POTFILES.in: Add remaining source files using i18n.h
      tests: include system headers before gphoto2 headers
      tests: declare local variable local
      sync gp-gettext-hack.m4 files between gphoto-m4 dirs
      HACKING.md: Misc small improvements (grammar, whitespace, etc.)
      HACKING.md: Update with C99 being our requirement
      HACKING.md: Add note about printf(3) fmt strings using "%m"
      gp-camlibs.m4: Fix GP_SLEEP invocation in in Gentoo hack
      tests: Remove old pedantic compilation tests
      tests: Always define, but only test conditionally
      tests: add pedantic compile tests for -std={c2x,c++20}
      Make the compiler warnings work with clang, gcc, and others
      Update libltdl checks (GP_LIBLTDL)
      Update the checks for libjpeg (GP_LIBJPEG)
      gitignore for tests/
      Use m4_pattern_forbid to find unnoticed GP_ strings
      AC_INIT change to arguments on multiple lines
      AM_INIT_AUTOMAKE change to indented multi-line form
      AC_CONFIG_FILES change to indented multi-line form
      m4 quote all macro arguments
      gh workflow: install libgd-dev
      Consistent checks for asm .symver and version-script
      Use the same gettext setup
      Use LINGUAS files instead of ALL_LINGUAS variable
      remove old libtool/libltdl comments
      make gphoto-m4 directories identical
      indentation for readability
      Remove definition of localedir
      Add build tool version comment
      Require at least autoconf-2.69
      Require at least automake 1.14
      Only use a single gphoto-m4/ subdir
      Add "mode: autoconf" line to all *.m4 files
      with-camlibs: grammar fix for standard set description
      with-camlibs: document "everything" set in the --help output
      Use non-reserved macro name for generated gphoto-endian.h
      Add compiletime-assert.h for COMPILETIME_ASSERT() macro
      ptp2/ptp.c: tell emacs the c-file-style
      ptp2/ptp.c: Rewrite PTP_CNT_INIT to build with pure C99
      remove whitespace around AS_HELP_STRING options
      Remove --with-doc-dir and --with-html-dir
      rearrange test-pedantic definitions
      The pedantic compilation flags might ignore some warnings
      RELEASE-HOWTO.md: Change the name of the IRC network
      Invoke AC_PROG_SED before using ${SED}
      Require at least libtool 2.4.2, use LT_INIT
      Remove commented out hack for pre-2001 gettext
      Add TODO comment about possibly using gettext's gettext.h
      MAINTAINERS: remove rpm builds
      Document translating languages outside Translation Project
      RELEASE-HOWTO.md: Improve markdown readability
      Require gettext >= 0.18.3; remove GP_GETTEXT_HACK
      Add pull-translations target
      Add test-i18n.c i18n test program
      Verbose gettext domain consistency checks

Ingvar Stepanyan (11):
      Provide correct search size to memchr
      Revamp Sony ISO logic
      Fix infinite loop when setting Sony values
      Fix overshoot logic for Sony enums
      Mark properties without setters as readonly
      Add file extension for Sony ARW files
      Remove duplicate GP_MIME_ARW
      Normalize Sony shutter speeds
      Fix memory leak in capture preview for Sony
      Add Sony a6600 descriptors
      Add few more movie modes for Sony

Jakub Bogusz (1):
      updated polish

Jan Kundrát (4):
      camlibs/ptp2/ptp-pack.c: Fix aperture on EOS RP
      Canon: basic control over Movie Servo AF
      Add mode dial positions available on EOS RP or 5Div
      Add HDR exposure mode from EOS RP

Jan Tojnar (1):
      print-camera-list: clarify help

Jaroslav Škarvada (1):
      Fixed build in mingw

Jiri Machalek (1):
      mime type update for CR3

Marcus Meissner (242):
      2.5.26.1 development starts
      define _DARWIN_C_SOURCE for strdup on MacOS. fixes gphoto/libgphoto2#552
      also do tar.xz
      do not add changecamera mode on the Nikon V1
      do not query for PTP_DPC_NIKON_LiveViewStatus
      mark nikon v1 as with broken cpature,. also disable the 90c7 event handling as this also crahes the camera. gphoto/libgphoto2#569
      on nikon v1, also blank out the nikon specific capture
      pass the usb interface to the control pipeline command functions
      added 2 new ricoh models from libmtp/libmtp#68
      comment out the broken flags again so we get good filesiszes from Samsung Galaxy
      dedup a name
      revert back to 0 byte PTP strings turning into "" instead of NULL.
      detect objects larger than 4gb.
      added 64bit file support for Nikon DSLR
      add 4gb news
      added ricoh theta z1 and v debugging
      wait busy also handle the bulb captuzre busyness
      actually use the proplist for the size ... gphoto/libgphoto2#582
      remove ()
      check for -lws2_32 to enable winsock support for ptpip on windows
      fix jpeg -> ws232 typo
      added fuji finepix s8600
      do not error on files larger than 4GB, our ptp getobject method can handle them.
      updated
      added new changeapplicationmode for Z6 II
      added more z6 ii commands
      decode new ptp oc nikon codes
      added P1000
      added liveview zoom area ... left hand value of WidthxHeight
      added fuji x-s10 usb ids and debug output
      according to http://fujifilm-x.com/global/support/compatibility/software/x-webcam/ this is doing capture preview at least, gphoto/libgphoto2#603
      fuji x-s10 in webcam mode
      adjust busy wait on fuji preview capture to be 5ms instead of 1ms
      added g12 ids
      added 2 more nikon event codes
      add a workraound to detect card value even if there is no enum.
      added EOS M1 Mark II another ID, from timelapse-VIEW
      added Sony A7S III
      for Sony ALPHA, return a static list of f-numbers if we get "range" for it.
      the Nikon Z series movie capture want to wait for the event confirming finished movie capture before proceeding
      add event queue check / remove by type functions.
      switch to use a remove event by type functiion in nikon capture
      reduce wait times in the eos preview loop again.
      added powershot g12 debug
      decode EOS names for easier debugging.
      the getviewfinderdata has 3 arguments... also use 00200000 like in current traces
      implemented nikon check event ex
      added missing ptp-pack part for nikon_check_event_ex
      handle canon ptpip same as nikon ptpip
      add eventmode option for canon eos.
      hook in nikon geteventex function.
      support more MTP ObjectPropDesc types
      The EOS M6 Mark II is more similar to the traditional EOS, than the EOS M series.
      x-s10 has only webcam mode, no capture mode... fixes gphoto/libgphoto2#603
      added fuji x-s10 iopcodes
      year is 2021
      autopoweroff might be 32bit
      refine debug of ptpip responses
      skip the unknown data in front of the preview using the 4 byte offset
      added sony a7r2 debug
      handle deviceinfo changed events in wait_for_event
      remove superflous print device info
      added streamid parameter to GetStreamInfo
      added canon eos m200
      blank serial nr
      added 9414 getliveview config
      added more autoexposuremodes (from eos m6 mark 2)
      decode more canon events a bit better
      set the cature timeout BEFORE calling captureimage, helps nikon v1
      generic initiate capture path:
      manage all Z series with te z6 config
      report movieprohibit and liveviewprohibit
      camlibs/ptp2/ptp-pack.c: Fix get-config iso/aperture for R5. (#621)
      seperate prohibits by comma
      move some enums to their known places, eos cameranickname is a string
      report camera nickname
      added OLC 0x12 for EOS M6 Mark2 offsets
      adjust more offset for eos m6 mark 2 OLC
      added strobofiring, flashcharged, oneshotrawon, autoexposuremodedial
      return the correct OK value on success
      added liveviewsize configuration for panasonic. set is not workign fully. gphoto/libgphoto2#575
      also include x value in config for now
      replaced some malloc(x*y) by calloc(x,y), also removed then superflous memset
      replaced some malloc(x*y) by calloc(x,y), removed 1 superflous memset
      replaced more malloc(x*y) by calloc(x,y)
      move around panasonic liveviewdata
      use define instead of magic constant
      optimize panasonic whitebalance
      added more info on panasonic things
      implemented getcapturetarget
      add more defines for panasonic, use some defines for queries instead of magic values
      added movie recording for panasonic lumix
      added panasonic deviceprop sniffs
      added more sniffed data
      added a missing propdesc freeing
      added missing propdescfree
      added some missing free propdesc and free objectinfo in sony trigger capture
      movie is a toggle,. not text
      removed a double free (Coverity)
      imported from libmtp
      removed a superflous argument (Coverity)
      updated to current state
      fixed a memleak (Coverity)
      fixed incorrect NULL check (Coverity)
      2.5.27 release
      update RELEASE-HOWTO.md
      2.5.27.1 dev release
      added Konica-Minolta:DiMAGE Z6
      move Fujifilm X100V to corect ordered by place
      olympus would wait twice the time due to a missing return
      added polympus note
      also added DSC-RX0M2 here for intiial wait, see gphoto/gphoto2#349
      added note about manual focusing not needing delay
      added sony a7c
      also wait 3 seconds for the A7C
      add download when announcing
      added #define _DARWIN_C_SOURCE as in other files to avoid implicit
      use isoc99 source gphoto/libgphoto2#633
      use darwin_c_source ... isoc99 source does not seem to cut it for macos. gphoto/libgphoto2#633
      support sony prioritymode, init it to 1.
      added d780 aapture settings.
      added coolpix b500
      added movieexposurecompensation
      fix movieexposurebiascompensation
      added fuji xpro3
      start sigma fp support. gphoto/libgphoto2#537
      added sigmafp liveview function, decode sigmafp codes
      sigma fp liveview now works
      first sucessfull (but not fully correct) capture code for sigma fp
      added cleardbsingleimage after capture
      implemented getpictfileinfo2ext for sigma fp
      implemented capture status, used it to cehck for finished capture
      wait a bit longer for image processing
      add some more defines, name 9035 camerainfo
      pass id to clearimagedb
      debug output all data groups for the sigma fp
      start the work of allowing sigma fp configuration
      first try at shutterspeed for sigma fp
      added sonx rx1r m2
      added eos m50m2
      added sigma fp shutterspeed mapping from SDK table
      added sigma fp aperture handling (untested)
      added correct property for manualfocus sony
      added liveview support to x-t30, but no capture. gphoto/gphoto2#196
      added d5000
      report that nikons cannot upload
      fuji: instead of special casing fuji, just return GP_OK from the fuji branch
      added Fuji:Fujifilm GFX 100S
      updated NEWS
      added eos1300d
      allow cancel for bytes_read >= 1MB to cover blob read size in ptp
      added a7s data
      harmoize the jpeg extractors pointer arithmetic for memchr to be valid C
      use the large jump on first try, fall back to single jumps on next loops
      added more braces to the new expressions to make clear what we test
      make the textual description of syncdatetimeutc also mention UTC
      fixed some memory leaks caused by ptp_getobjectinfo imbalanced with ptp_free_objectinfo, see gphoto/libgphoto2#690
      temporary allow setting all properties on sony, as ourdetection logic does not seem to be right.
      remove memory leaks
      report changed config labels during wait
      decode value of regular widgets
      added property change decoding to EOS and Olympus
      more debug, also switch conditions to avoid O(n2) complexity
      srtore DevPropCode, needed by current config name matcher
      trying to fix eos reader
      emit also new values in the config update work (draft work) gphoto/libgphoto2#677
      factorize out the jpeg extraction out of data blobs
      further factor out the preview saving and meta data setting, as its common
      use generic preview.jpg name, not sony for ... fuji
      move another preview jpeg extractor to factorized function
      factor out regular image additions repeated code
      added fuji gfx100 second id reported via SF
      for sony preview capture use a timeout of 1 second
      replaced R2 -> RP
      added sony zv-e10
      added sony zv e10
      pass lenght of datablobs into the directory compare function to avoid overreads
      harden the directory compare function against overreads
      handle busy errors on getobjectinfo
      turn zoom widget into a range.
      check for errors from widget functions
      merged music-players.h from libmtp
      also register port vusb:
      start a sample for libfuzz
      addred a missing gp_port_info_new
      remove 1 warning
      added sample-libfuzz ... semi-uable for libfuzzer
      added comment how to build fuzzer, and current problems
      fixed uninitialized memory access / potential crash
      better comments
      added u1-u3 for nikon
      decode usermode
      added z6 note
      report file info for debugging
      report only if flag set
      also handle j1 like v1 ...blank out getevent and imagerecinsdram
      report file info
      requzest the objectinfo to be loaded
      fixed return code from unprepare capture during EOS exit
      emit only matching resetuilock if we did setuilock
      added j1 issue
      fix build after bayer.h change
      added pentax k3 II in ptzp mode
      only ovbrwrite the PEF header for the K100D.
      emit a FILE CHANGED event if the ObjectInfo changes.
      some updates
      somre more updates
      rev the age of the library.
      added note for the 1:0:7 rev
      add more news
      make update-po
      updated german
      german translation completed
      spelling fixes
      more speling fixes
      more spellchecking
      avoid duplicate mvoie / liveview prohibition code strings for translation
      simplified after prohibit simplification
      added creative auto mode dial setting
      sync from libmtp
      handle motorola as MTP... fixes gphoto/gphoto2#463
      we need to refetch the ptp object after get_folder_from_handle, as that call might invalidatze the poionter
      Factored out more things into add_object_to_fs_and_path helper
      factory out 2 more instances for standardized object adding
      factor out more instances of 'add handle to filesystem'
      updated de
      fixed an uninit variable
      added c++ wrappers
      remove superflous ;
      avoid crash on freed memory
      added pentax k1
      added pentax k1
      aded sony sx-hx80
      added pentax k1 id
      added Sony ILCE-7RM4A gphoto/libgphoto2#749
      remove dup k1
      adjust hex id to have 4 digits, fixes gphoto/libgphoto2#753
      fix camera name, fixes gphoto/libgphoto2#754
      sync from libmtp
      added more NEWS
      keep canon eos remotemode=1 on exit, to keep the display on
      2.5.28 release

Ole Dalgaard (1):
      Add Nikon Zfc support

Ondrej Zary (3):
      sierra: Add workaround for Epson PhotoPC 500 at higher speeds
      sierra: Add SIERRA_PACKET_CANCEL (0x18) as valid resonse
      sierra: Add curly braces to improve code readability

Pino Toscano (2):
      directory: use statvfs instead of statfs
      directory: enable storage_info_func on any platform

Rafał Hirsz (1):
      Add _DARWIN_C_SOURCE to most files that use string.h (#615)

Stéphane Aulery (2):
      updated french
      updated french

Sven Killig (1):
      added PowerShot exposure compensation values

Wolfram Sang (1):
      ptp2: add Canon IXUS 132

Yuri Chornoivan (1):
      updated ukrainian

Zeranoe (2):
      Remove stdint.h shim (#625)
      Fix byte swap calls (#626)

avisecag (1):
      Added USB ID for Nikon Z6_2 (#583)

fahrion2600 (2):
      Recognize Nikon Z 7II and fix VendorExtensionID over PTP/IP (#605)
      Also set params->controlmode in _put_Nikon_ControlMode (#606)

gregmag (1):
      Update library.c

tomsch1 (2):
      Update library.c
      Create sony-a7r3a.txt

trilader (1):
      Add support for reading Canon EOS MovieMode switch and setting it on/off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants