Browse Source

Prevent memory leak on error.

Georgi Chorbadzhiyski 4 years ago
parent
commit
39377eeeca
1 changed files with 1 additions and 1 deletions
  1. 1 1
      data.c

+ 1 - 1
data.c View File

@@ -351,9 +351,9 @@ NIT *nit_new(uint16_t ts_id, char *freq, char *mod, char *symbol_rate) {
351 351
 	char tmp[9];
352 352
 	unsigned i, pos;
353 353
 
354
-	NIT *n = calloc(1, sizeof(NIT));
355 354
 	if (strlen(freq) != 9 || strlen(symbol_rate) != 8)
356 355
 		return NULL;
356
+	NIT *n = calloc(1, sizeof(NIT));
357 357
 	n->freq        = strdup(freq);
358 358
 	n->modulation  = strdup(mod);
359 359
 	n->symbol_rate = strdup(symbol_rate);