X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fdevice.c;h=38ac003cf01d7433b9c1767ccf3ace01d70329db;hb=4bf93988023b2428129c8145ef9ea7121400f195;hp=ace11dd86204b178a63ef903b7006c889ddd8661;hpb=8662130615d7a59883c303914f94377032101cb9;p=libsigrok.git diff --git a/src/device.c b/src/device.c index ace11dd8..38ac003c 100644 --- a/src/device.c +++ b/src/device.c @@ -339,7 +339,7 @@ SR_API int sr_dev_inst_channel_add(struct sr_dev_inst *sdi, int index, int type, /** * Free device instance struct created by sr_dev_inst(). * - * @param sdi Device instance to free. Must not be NULL. + * @param sdi Device instance to free. If NULL, the function will do nothing. * * @private */ @@ -349,6 +349,9 @@ SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi) struct sr_channel_group *cg; GSList *l; + if (!sdi) + return; + for (l = sdi->channels; l; l = l->next) { ch = l->data; g_free(ch->name);