Browse code

proper hadnling of failed mallocs introduced

Jiri Kuthan authored on 28/04/2004 18:43:52
Showing 1 changed files
... ...
@@ -481,11 +481,11 @@ str* subst_str(char *input, struct sip_msg* msg, struct subst_expr* se)
481 481
 		goto error;
482 482
 	}
483 483
 	res->s=pkg_malloc(len+1); /* space for null termination */
484
-	res->s[len]=0;
485 484
 	if (res->s==0){
486 485
 		LOG(L_ERR, "ERROR: subst_str: mem. allocation error (res->s)\n");
487 486
 		goto error;
488 487
 	}
488
+	res->s[len]=0;
489 489
 	res->len=len;
490 490
 	
491 491
 	/* replace */