avoid crash on freed memory

This commit is contained in:
Marcus Meissner
2021-11-28 15:28:37 +01:00
parent 27939ca769
commit e43230ef45

View File

@@ -182,13 +182,15 @@ int main(int argc, char **argv) {
ret = gp_list_get_name(list, 0, &name);
if (ret < GP_OK) goto out;
gp_list_free (list);
fprintf(stderr, "name is %s\n", name);
ret = sample_open_camera (&camera, name, buf, context);
if (ret < GP_OK) {
fprintf(stderr,"camera %s at %s not found.\n", name, buf);
gp_list_free (list);
goto out;
}
gp_list_free (list);
ret = gp_camera_init (camera, context);
if (ret < GP_OK) {