I have met a similar crash too:
motion[4059]: segfault at b444513f ip b769ee8a sp b5440b40 error 4 in
libjpeg.so.8.4.0[b7682000+38000]
I think that in my case the problem was that width and height in config did
not match resolution supported by my camera.
I had 800x608 in config, which worked until I started to pause/resume
detection or disconnect/reconnect my camera while motion was running. My
suspicion was that motion mmaps buffer for picture according to camera
supported resolution, but passes that buffer with config resolution to
libjpeg. E.g. allocates 800x600, and then passes it to libjpeg with 800x608.
I re-compiled motion with -g3 and -O0 and captured a core when this
happened:
(gdb) bt
#0 jpeg_fdct_ifast (data=data@entry=0xb5d36b90,
sample_data=sample_data@entry=0xb5d36fa8,
start_col=start_col@entry=0) at jfdctfst.c:132
#1 0xb7f7e92c in forward_DCT (cinfo=cinfo@entry=0xb5d36df0,
compptr=compptr@entry=0x80c16bc,
sample_data=0xb5d36fa8, coef_blocks=0x80c224c, start_row=start_row@entry=0,
start_col=start_col@entry=0,
num_blocks=num_blocks@entry=1) at jcdctmgr.c:82
#2 0xb7f7dd6c in compress_data (cinfo=0xb5d36df0, input_buf=0xb5d36f9c) at
jccoefct.c:181
#3 0xb7f7bc07 in jpeg_write_raw_data (cinfo=0xb5d36df0, data=0xb5d36f9c,
num_lines=16) at jcapistd.c:153
#4 0x080674f0 in put_jpeg_yuv420p_file (fp=0x80c1440,
image=0xb4c8b008
\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200...,
width=800, height=600, quality=85) at picture.c:264
#5 0x08067d7c in put_picture_fd (cnt=0x80ba7d8, picture=0x80c1440,
image=0xb4c8b008
\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200...,
quality=85) at picture.c:517
#6 0x08067eb7 in put_picture (cnt=0x80ba7d8, file=0xb5d3a11c
/motion/01-20150326165903-snapshot.jpg,
image=0xb4c8b008
\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200...,
ftype=2) at picture.c:550
---Type return to continue, or q return to quit---
#7 0x08066028 in event_image_snapshot (cnt=0x80ba7d8, type=1024,
img=0xb4c8b008