diff --git a/tsk/vs/gpt.c b/tsk/vs/gpt.c
index 2ee85c66327f4f701cfd476372de2765a30141c3..cf6bc4ac830aeb6c6051df05c3f87b3422c95c8f 100644
--- a/tsk/vs/gpt.c
+++ b/tsk/vs/gpt.c
@@ -130,12 +130,11 @@ gpt_load_table(TSK_VS_INFO * vs, GPT_LOCATION_ENUM gpt_type)
     }
 
     // now that we checked the sig, lets make the meta  entries
-    if ((safe_str = tsk_malloc(16)) == NULL) {
-        free(sect_buf);
-        return 1;
-    }
-
-    if(gpt_type == PRIMARY_TABLE){
+    if (gpt_type == PRIMARY_TABLE) {
+        if ((safe_str = tsk_malloc(16)) == NULL) {
+            free(sect_buf);
+            return 1;
+        }
         snprintf(safe_str, 16, "Safety Table");
         if (NULL == tsk_vs_part_add(vs, (TSK_DADDR_T) 0, (TSK_DADDR_T) 1,
                 TSK_VS_PART_FLAG_META, safe_str, -1, -1)) {