diff options
author | Vivia Nikolaidou <vivia@ahiru.eu> | 2017-11-09 00:16:21 +0200 |
---|---|---|
committer | Vivia Nikolaidou <vivia@ahiru.eu> | 2017-11-09 00:19:42 +0200 |
commit | bae9427dc1abd29f03a524e4f30667876682600e (patch) | |
tree | e22935841f8a573a7c917001faa0dfd1db3f99eb /sys/decklink/gstdecklink.cpp | |
parent | f78be9d6988b1c3d1482a981c94a545e79645e43 (diff) |
decklink: Don't crash when getting hw serial number doesn't return OK
If the return value isn't OK, it means we might be getting data that
points to an invalid memory address. That shouldn't make us crash.
Diffstat (limited to 'sys/decklink/gstdecklink.cpp')
-rw-r--r-- | sys/decklink/gstdecklink.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/decklink/gstdecklink.cpp b/sys/decklink/gstdecklink.cpp index 58af0c607..85498c9b1 100644 --- a/sys/decklink/gstdecklink.cpp +++ b/sys/decklink/gstdecklink.cpp @@ -1239,11 +1239,13 @@ init_devices (gpointer data) devices[i].input. config->GetString (bmdDeckLinkConfigDeviceInformationSerialNumber, (COMSTR_T *) & serial_number); - CONVERT_COM_STRING (serial_number); - devices[i].output.hw_serial_number = g_strdup (serial_number); - devices[i].input.hw_serial_number = g_strdup (serial_number); - GST_DEBUG ("device %d has serial number %s", i, serial_number); - FREE_COM_STRING (serial_number); + if (ret == S_OK) { + CONVERT_COM_STRING (serial_number); + devices[i].output.hw_serial_number = g_strdup (serial_number); + devices[i].input.hw_serial_number = g_strdup (serial_number); + GST_DEBUG ("device %d has serial number %s", i, serial_number); + FREE_COM_STRING (serial_number); + } } ret = decklink->QueryInterface (IID_IDeckLinkAttributes, |