fix a memory leak
[calc.git] / tabular.c
index a7916a47531a60aad42c59f6c8962b0a51b58f28..83c17898248b07dd3495be769bbcdc7b35eddd2c 100644 (file)
--- a/tabular.c
+++ b/tabular.c
@@ -43,6 +43,9 @@ tab_t *resize_tab (tab_t *tab, int nb)
 
 tab_t *copy_tab (tab_t *tab)
 {
+    if (tab == NULL) {
+        return NULL;
+    }
     tab_t *new = alloc_tab (tab->size);
     memcpy (new->data, tab->data, tab->size * sizeof (double));
     return new;