diff options
author | Omri Sarig <omri.sarig13@gmail.com> | 2022-10-11 18:51:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-11 18:51:16 +0200 |
commit | d2e3fef8e08ce77ef6a5115a5d7b01be4f8b5e36 (patch) | |
tree | 00047550d9d36242ac79d3e8cc08516174ea9b49 | |
parent | 680be84eeb4a4f1f493ba5de4481632d88ca2e5a (diff) | |
download | libgphoto2-d2e3fef8e08ce77ef6a5115a5d7b01be4f8b5e36.tar.gz |
Fix pointer issues in local PTP event queue in Nikon capture (#849)
https://github.com/gphoto/libgphoto2/issues/846
Co-authored-by: Omri Sarig <omri.sarig@prevas.dk>
-rw-r--r-- | camlibs/ptp2/library.c | 4 | ||||
-rw-r--r-- | camlibs/ptp2/ptp.c | 6 | ||||
-rw-r--r-- | camlibs/ptp2/ptp.h | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index 4ec0990f9..a0b0aea77 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -4170,7 +4170,7 @@ capturetriggered: if (ret != PTP_RC_OK) { /* store back all the queued events back to the hw event queue before returning. */ /* we do not do this in all error edge cases currently, only the ones that can trigger often */ - ptp_add_events (params, &storedevents, nrstoredevents); + ptp_add_events (params, storedevents, nrstoredevents); C_PTP_REP (ret); } @@ -4251,7 +4251,7 @@ capturetriggered: } while ((done != 3) && waiting_for_timeout (&back_off_wait, capture_start, 70*1000)); /* 70 seconds */ /* add all the queued events back to the event queue */ - ptp_add_events (params, &storedevents, nrstoredevents); + ptp_add_events (params, storedevents, nrstoredevents); /* Maximum image time is 30 seconds, but NR processing might take 25 seconds ... so wait longer. * see https://github.com/gphoto/libgphoto2/issues/94 */ diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c index 5bdce1c97..21a50f07a 100644 --- a/camlibs/ptp2/ptp.c +++ b/camlibs/ptp2/ptp.c @@ -3236,7 +3236,7 @@ ptp_add_event_queue (PTPContainer **events, unsigned int *nrevents, PTPContainer if (!levents) return PTP_RC_GeneralError; *events = levents; - memcpy (&events[*nrevents],evt,1*sizeof(PTPContainer)); + memcpy (&levents[*nrevents],evt,1*sizeof(PTPContainer)); (*nrevents)++; return PTP_RC_OK; } @@ -3254,12 +3254,12 @@ ptp_add_event (PTPParams *params, PTPContainer *evt) } uint16_t -ptp_add_events (PTPParams *params, PTPContainer **evt, unsigned int nrevents) +ptp_add_events (PTPParams *params, PTPContainer *evt, unsigned int nrevents) { unsigned int i; for (i=0;i<nrevents;i++) { - CHECK_PTP_RC (ptp_add_event_queue (¶ms->events, ¶ms->nrofevents, evt[i])); + CHECK_PTP_RC (ptp_add_event_queue (¶ms->events, ¶ms->nrofevents, &evt[i])); } return PTP_RC_OK; } diff --git a/camlibs/ptp2/ptp.h b/camlibs/ptp2/ptp.h index 914abdede..48719b2d5 100644 --- a/camlibs/ptp2/ptp.h +++ b/camlibs/ptp2/ptp.h @@ -4033,7 +4033,7 @@ uint16_t ptp_check_event (PTPParams *params); uint16_t ptp_check_event_queue (PTPParams *params); uint16_t ptp_wait_event (PTPParams *params); uint16_t ptp_add_event (PTPParams *params, PTPContainer *evt); -uint16_t ptp_add_events (PTPParams *params, PTPContainer **evt, unsigned int nrevents); +uint16_t ptp_add_events (PTPParams *params, PTPContainer *evt, unsigned int nrevents); uint16_t ptp_add_event_queue (PTPContainer **events, unsigned int *nrevents, PTPContainer *evt); int ptp_have_event(PTPParams *params, uint16_t code); int ptp_get_one_event (PTPParams *params, PTPContainer *evt); |