comparison cli-runopts.c @ 407:ea0929224294

Fix another leak found by Klocwork
author Matt Johnston <matt@ucc.asn.au>
date Sat, 03 Feb 2007 13:50:47 +0000
parents 306499676384
children b895f91c2ee6 253958302381
comparison
equal deleted inserted replaced
406:2448ae3e75b5 407:ea0929224294
356 connectaddr = strchr(str, ':'); 356 connectaddr = strchr(str, ':');
357 if (connectaddr == NULL) { 357 if (connectaddr == NULL) {
358 TRACE(("connectaddr == NULL")) 358 TRACE(("connectaddr == NULL"))
359 goto fail; 359 goto fail;
360 } 360 }
361 361 *connectaddr = '\0';
362 connectaddr[0] = '\0';
363 connectaddr++; 362 connectaddr++;
364 363
365 connectport = strchr(connectaddr, ':'); 364 connectport = strchr(connectaddr, ':');
366 if (connectport == NULL) { 365 if (connectport == NULL) {
367 TRACE(("connectport == NULL")) 366 TRACE(("connectport == NULL"))
368 goto fail; 367 goto fail;
369 } 368 }
370 369 *connectport = '\0';
371 connectport[0] = '\0';
372 connectport++; 370 connectport++;
373 371
374 newfwd = (struct TCPFwdList*)m_malloc(sizeof(struct TCPFwdList)); 372 newfwd = (struct TCPFwdList*)m_malloc(sizeof(struct TCPFwdList));
375 373
376 /* Now we check the ports - note that the port ints are unsigned, 374 /* Now we check the ports - note that the port ints are unsigned,
400 } 398 }
401 399
402 newfwd->next = *fwdlist; 400 newfwd->next = *fwdlist;
403 *fwdlist = newfwd; 401 *fwdlist = newfwd;
404 402
403 m_free(str);
404
405 TRACE(("leave addforward: done")) 405 TRACE(("leave addforward: done"))
406 return; 406 return;
407 407
408 fail: 408 fail:
409 dropbear_exit("Bad TCP forward '%s'", origstr); 409 dropbear_exit("Bad TCP forward '%s'", origstr);