diff options
author | Felipe Franciosi <felipe@nutanix.com> | 2019-12-04 15:50:14 +0000 |
---|---|---|
committer | Felipe Franciosi <felipe@nutanix.com> | 2020-08-12 12:14:54 +0100 |
commit | 750f3eadcabd35dc6fd6eefbffe0e677894953f2 (patch) | |
tree | ac70500e68f92dd57b04ecab8fc5e936cb7eb658 /lib/dma.c | |
parent | 8c23f852ebb8dcc2cb1ce98a157f9c50cf5bb0f4 (diff) | |
download | libvfio-user-750f3eadcabd35dc6fd6eefbffe0e677894953f2.zip libvfio-user-750f3eadcabd35dc6fd6eefbffe0e677894953f2.tar.gz libvfio-user-750f3eadcabd35dc6fd6eefbffe0e677894953f2.tar.bz2 |
dma: Cope with dma being NULL in destructor
On certain error paths, @dma will be NULL. This makes the destructor
cope with it.
Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
Diffstat (limited to 'lib/dma.c')
-rw-r--r-- | lib/dma.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -137,6 +137,10 @@ dma_controller_remove_regions(lm_ctx_t *ctx, dma_controller_t *dma) void dma_controller_destroy(lm_ctx_t *lm_ctx, dma_controller_t *dma) { + if (dma == NULL) { + return; + } + dma_controller_remove_regions(lm_ctx, dma); free(dma); } |